Skip to content

Commit 0919d00

Browse files
Add GUI test for source code page sidebar
1 parent 65ed5f3 commit 0919d00

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Diff for: src/test/rustdoc-gui/sidebar-source-code.goml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// The goal of this test is to ensure that the sidebar is working as expected in the source
2+
// code pages.
3+
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
4+
// First: desktop mode.
5+
size: (1100, 800)
6+
// We check that the sidebar isn't expanded and has the expected width.
7+
assert-css: ("nav.sidebar", {"width": "50px"})
8+
// We now click on the button to expand the sidebar.
9+
click: (10, 10)
10+
// We wait for the sidebar to be expanded (there is a 0.5s animation).
11+
wait-for: 600
12+
assert-css: ("nav.sidebar.expanded", {"width": "300px"})
13+
// We collapse the sidebar.
14+
click: (10, 10)
15+
// We wait for the sidebar to be collapsed (there is a 0.5s animation).
16+
wait-for: 600
17+
// We ensure that the class has been removed.
18+
assert-false: "nav.sidebar.expanded"
19+
assert: "nav.sidebar"
20+
21+
// We now switch to mobile mode.
22+
size: (600, 600)
23+
// We check that the sidebar has the expected width (0 and 1px for the border).
24+
assert-css: ("nav.sidebar", {"width": "1px"})
25+
// We expand the sidebar.
26+
click: "#sidebar-toggle"
27+
assert-css: ("nav.sidebar.expanded", {"width": "600px"})
28+
// We collapse the sidebar.
29+
click: (10, 10)
30+
// We ensure that the class has been removed.
31+
assert-false: "nav.sidebar.expanded"
32+
assert: "nav.sidebar"

0 commit comments

Comments
 (0)