Skip to content

Commit 9a1f52d

Browse files
Add test to ensure that scroll position is kept when opening/closing source sidebar
1 parent 72f6322 commit 9a1f52d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/rustdoc-gui/sidebar-source-code-display.goml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,17 @@ assert-css: (
138138
"border-bottom-width": "1px",
139139
},
140140
)
141+
142+
// We now check that the scroll position is kept when opening the sidebar.
143+
click: "#sidebar-toggle"
144+
wait-for-css: (".sidebar", {"width": "0px"})
145+
// We scroll to line 117 to change the scroll position.
146+
scroll-to: '//*[@id="117"]'
147+
assert-window-property: {"pageYOffset": "2519"}
148+
// Expanding the sidebar...
149+
click: "#sidebar-toggle"
150+
wait-for-css: (".sidebar", {"width": "500px"})
151+
click: "#sidebar-toggle"
152+
wait-for-css: (".sidebar", {"width": "0px"})
153+
// The "scrollTop" property should be the same.
154+
assert-window-property: {"pageYOffset": "2519"}

0 commit comments

Comments
 (0)