]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-gui/sidebar-mobile-scroll.goml
Rollup merge of #104252 - faern:stabilize-const_socketaddr, r=JohnTitor
[rust.git] / tests / rustdoc-gui / sidebar-mobile-scroll.goml
1 // This test ensures that the mobile sidebar preserves scroll position.
2 goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
3 // Switching to "mobile view" by reducing the width to 600px.
4 size: (700, 600)
5 assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
6
7 // Scroll down.
8 scroll-to: "//h2[@id='blanket-implementations']"
9 assert-window-property: {"pageYOffset": "627"}
10
11 // Open the sidebar menu.
12 click: ".sidebar-menu-toggle"
13 wait-for-css: (".sidebar", {"left": "0px"})
14
15 // We are no longer "scrolled". It's important that the user can't
16 // scroll the body at all, but these test scripts are run only in Chrome,
17 // and we need to use a more complicated solution to this problem because
18 // of Mobile Safari...
19 assert-window-property: {"pageYOffset": "0"}
20
21 // Close the sidebar menu. Make sure the scroll position gets restored.
22 click: ".sidebar-menu-toggle"
23 wait-for-css: (".sidebar", {"left": "-1000px"})
24 assert-window-property: {"pageYOffset": "627"}
25
26 // Now test that scrollability returns when the browser window is just resized.
27 click: ".sidebar-menu-toggle"
28 wait-for-css: (".sidebar", {"left": "0px"})
29 assert-window-property: {"pageYOffset": "0"}
30 size: (900, 600)
31 assert-window-property: {"pageYOffset": "627"}