about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-06-29 23:21:46 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-06-30 16:08:45 +0200
commit9a1f52d7fd78f3dc26b49d4490e4e8004f590fc3 (patch)
tree56cc123d9c223acb653f1341c0fb850333242af0
parent72f6322f8a50288a4bf96c9b20935f666a889621 (diff)
downloadrust-9a1f52d7fd78f3dc26b49d4490e4e8004f590fc3.tar.gz
rust-9a1f52d7fd78f3dc26b49d4490e4e8004f590fc3.zip
Add test to ensure that scroll position is kept when opening/closing source sidebar
-rw-r--r--src/test/rustdoc-gui/sidebar-source-code-display.goml14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml
index 0474a8638db..c441f84a821 100644
--- a/src/test/rustdoc-gui/sidebar-source-code-display.goml
+++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml
@@ -138,3 +138,17 @@ assert-css: (
         "border-bottom-width": "1px",
     },
 )
+
+// We now check that the scroll position is kept when opening the sidebar.
+click: "#sidebar-toggle"
+wait-for-css: (".sidebar", {"width": "0px"})
+// We scroll to line 117 to change the scroll position.
+scroll-to: '//*[@id="117"]'
+assert-window-property: {"pageYOffset": "2519"}
+// Expanding the sidebar...
+click: "#sidebar-toggle"
+wait-for-css: (".sidebar", {"width": "500px"})
+click: "#sidebar-toggle"
+wait-for-css: (".sidebar", {"width": "0px"})
+// The "scrollTop" property should be the same.
+assert-window-property: {"pageYOffset": "2519"}