1 // The goal of this test is to ensure that the sidebar is working as expected in the source
3 goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
4 // First: desktop mode.
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.
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.
15 // We ensure that the class has been removed.
16 wait-for: "html:not(.expanded)"
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.
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)
33 // We now switch to mobile mode.
35 wait-for-css: (".source-sidebar-expanded nav.sidebar", {"width": "600px"})
36 // We collapse the sidebar.
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"
44 // Check that the topbar is not visible
45 assert-false: ".mobile-topbar"