2022-06-30 17:28:29 -07:00
|
|
|
// This test ensures that the mobile sidebar preserves scroll position.
|
2023-04-11 19:11:34 +02:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
|
2022-06-30 17:28:29 -07:00
|
|
|
// Switching to "mobile view" by reducing the width to 600px.
|
2023-04-11 19:11:34 +02:00
|
|
|
set-window-size: (700, 600)
|
2022-06-30 17:28:29 -07:00
|
|
|
assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
|
|
|
|
|
|
|
|
// Scroll down.
|
|
|
|
scroll-to: "//h2[@id='blanket-implementations']"
|
2023-02-12 12:27:40 -07:00
|
|
|
assert-window-property: {"pageYOffset": "622"}
|
2022-06-30 17:28:29 -07:00
|
|
|
|
|
|
|
// Open the sidebar menu.
|
|
|
|
click: ".sidebar-menu-toggle"
|
|
|
|
wait-for-css: (".sidebar", {"left": "0px"})
|
|
|
|
|
|
|
|
// We are no longer "scrolled". It's important that the user can't
|
|
|
|
// scroll the body at all, but these test scripts are run only in Chrome,
|
|
|
|
// and we need to use a more complicated solution to this problem because
|
|
|
|
// of Mobile Safari...
|
|
|
|
assert-window-property: {"pageYOffset": "0"}
|
|
|
|
|
|
|
|
// Close the sidebar menu. Make sure the scroll position gets restored.
|
|
|
|
click: ".sidebar-menu-toggle"
|
|
|
|
wait-for-css: (".sidebar", {"left": "-1000px"})
|
2023-02-12 12:27:40 -07:00
|
|
|
assert-window-property: {"pageYOffset": "622"}
|
2022-06-30 17:28:29 -07:00
|
|
|
|
|
|
|
// Now test that scrollability returns when the browser window is just resized.
|
|
|
|
click: ".sidebar-menu-toggle"
|
|
|
|
wait-for-css: (".sidebar", {"left": "0px"})
|
|
|
|
assert-window-property: {"pageYOffset": "0"}
|
2023-04-11 19:11:34 +02:00
|
|
|
set-window-size: (900, 600)
|
2023-02-12 12:27:40 -07:00
|
|
|
assert-window-property: {"pageYOffset": "622"}
|