diff options
Diffstat (limited to 'vendor/web-sys/tests/wasm/history.rs')
-rw-r--r-- | vendor/web-sys/tests/wasm/history.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/web-sys/tests/wasm/history.rs b/vendor/web-sys/tests/wasm/history.rs new file mode 100644 index 000000000..f3ecdc42e --- /dev/null +++ b/vendor/web-sys/tests/wasm/history.rs @@ -0,0 +1,28 @@ +use wasm_bindgen::prelude::*; +use wasm_bindgen_test::*; +use web_sys::{History, ScrollRestoration}; + +#[wasm_bindgen] +extern "C" { + #[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 + ); +} |