wasm-bindgen/crates/web-sys/tests/wasm/history.rs
2018-08-01 00:01:03 -05:00

19 lines
632 B
Rust

use wasm_bindgen_test::*;
use wasm_bindgen::prelude::*;
use web_sys::{History, ScrollRestoration};
#[wasm_bindgen]
extern {
#[wasm_bindgen(js_name = history, js_namespace = window)]
static HISTORY: History;
}
#[wasm_bindgen_test]
fn history() {
HISTORY.set_scroll_restoration(ScrollRestoration::Manual).expect("failure to set scroll restoration");
assert_eq!(HISTORY.scroll_restoration().unwrap(), ScrollRestoration::Manual);
HISTORY.set_scroll_restoration(ScrollRestoration::Auto).expect("failure to set scroll restoration");
assert_eq!(HISTORY.scroll_restoration().unwrap(), ScrollRestoration::Auto);
}