]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/sidebar-source-code.goml
Rollup merge of #100367 - fmease:fix-100365, r=compiler-errors
[rust.git] / src / test / rustdoc-gui / sidebar-source-code.goml
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.
11 wait-for-css: (".source-sidebar-expanded nav.sidebar", {"width": "300px"})
12 assert-css: (".source-sidebar-expanded nav.sidebar a", {"font-size": "14px"})
13 // We collapse the sidebar.
14 click: (10, 10)
15 // We ensure that the class has been removed.
16 wait-for: "html:not(.expanded)"
17 assert: "nav.sidebar"
18
19 // Checking that only the path to the current file is "open".
20 goto: file://|DOC_PATH|/src/lib2/another_folder/sub_mod/mod.rs.html
21 // First we expand the sidebar again.
22 click: (10, 10)
23 // We wait for the sidebar to be expanded.
24 wait-for-css: (".source-sidebar-expanded nav.sidebar", {"width": "300px"})
25 assert: "//*[@class='dir-entry' and @open]/*[text()='lib2']"
26 assert: "//*[@class='dir-entry' and @open]/*[text()='another_folder']"
27 assert: "//*[@class='dir-entry' and @open]/*[text()='sub_mod']"
28 // Only "another_folder" should be "open" in "lib2".
29 assert: "//*[@class='dir-entry' and not(@open)]/*[text()='another_mod']"
30 // All other trees should be collapsed.
31 assert-count: ("//*[@id='source-sidebar']/details[not(text()='lib2') and not(@open)]", 5)
32
33 // We now switch to mobile mode.
34 size: (600, 600)
35 wait-for-css: (".source-sidebar-expanded nav.sidebar", {"width": "600px"})
36 // We collapse the sidebar.
37 click: (10, 10)
38 // We check that the sidebar has the expected width (0).
39 assert-css: ("nav.sidebar", {"width": "0px"})
40 // We ensure that the class has been removed.
41 assert-false: ".source-sidebar-expanded"
42 assert: "nav.sidebar"
43
44 // Check that the topbar is not visible
45 assert-property: (".mobile-topbar", {"offsetParent": "null"})