]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/sidebar.goml
Rollup merge of #92692 - jsha:cool-sidebar, r=GuillaumeGomez
[rust.git] / src / test / rustdoc-gui / sidebar.goml
1 goto: file://|DOC_PATH|/test_docs/index.html
2 show-text: true
3 local-storage: {"rustdoc-theme": "light"}
4 // We reload the page so the local storage settings are being used.
5 reload:
6
7 assert-text: (".sidebar > .location", "Crate test_docs")
8 // In modules, we only have one "location" element.
9 assert-count: (".sidebar .location", 1)
10 assert-text: ("#all-types", "All Items")
11 assert-css: ("#all-types", {"color": "rgb(56, 115, 173)"})
12 // We check that we have the crates list and that the "current" on is "test_docs".
13 assert-text: (".sidebar-elems .crate > ul > li > a.current", "test_docs")
14 // And we're also supposed to have the list of items in the current module.
15 assert-text: (".sidebar-elems .items > ul > li:nth-child(1)", "Modules")
16 assert-text: (".sidebar-elems .items > ul > li:nth-child(2)", "Macros")
17 assert-text: (".sidebar-elems .items > ul > li:nth-child(3)", "Structs")
18 assert-text: (".sidebar-elems .items > ul > li:nth-child(4)", "Enums")
19 assert-text: (".sidebar-elems .items > ul > li:nth-child(5)", "Traits")
20 assert-text: (".sidebar-elems .items > ul > li:nth-child(6)", "Functions")
21 assert-text: (".sidebar-elems .items > ul > li:nth-child(7)", "Type Definitions")
22 assert-text: (".sidebar-elems .items > ul > li:nth-child(8)", "Unions")
23 assert-text: (".sidebar-elems .items > ul > li:nth-child(9)", "Keywords")
24 assert-text: ("#structs + .item-table .item-left > a", "Foo")
25 click: "#structs + .item-table .item-left > a"
26
27 // PAGE: struct.Foo.html
28 assert-count: (".sidebar .location", 2)
29 // We check that there is no crate listed outside of the top level.
30 assert-false: ".sidebar-elems > .crate"
31
32 click: ".sidebar-links a"
33 assert-property-false: ("html", {"scrollTop": "0"})
34
35 click: ".sidebar h2.location a"
36 assert-property: ("html", {"scrollTop": "0"})
37
38 // We now go back to the crate page to click on the "lib2" crate link.
39 goto: file://|DOC_PATH|/test_docs/index.html
40 assert-css: (".sidebar-elems .crate > ul > li:first-child > a", {"color": "rgb(56, 115, 173)"})
41 click: ".sidebar-elems .crate > ul > li:first-child > a"
42
43 // PAGE: lib2/index.html
44 goto: file://|DOC_PATH|/lib2/index.html
45 assert-text: (".sidebar > .location", "Crate lib2")
46 // We check that we have the crates list and that the "current" on is now "lib2".
47 assert-text: (".sidebar-elems .crate > ul > li > a.current", "lib2")
48 // We now go to the "foobar" function page.
49 assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
50 assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
51 assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Traits")
52 assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Functions")
53 assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Type Definitions")
54 assert-text: ("#functions + .item-table .item-left > a", "foobar")
55 click: "#functions + .item-table .item-left > a"
56
57 // PAGE: fn.foobar.html
58 // In items containing no items (like functions or constants) and in modules, we have one
59 // "location" elements.
60 assert-count: (".sidebar .location", 1)
61 assert-text: (".sidebar .sidebar-elems .location", "In lib2")
62 // We check that we don't have the crate list.
63 assert-false: ".sidebar-elems > .crate"
64
65 goto: ./module/index.html
66 assert-text: (".sidebar > .location", "Module module")
67 // We check that we don't have the crate list.
68 assert-false: ".sidebar-elems > .crate"
69
70 goto: ./sub_module/sub_sub_module/index.html
71 assert-text: (".sidebar > .location", "Module sub_sub_module")
72 // We check that we don't have the crate list.
73 assert-false: ".sidebar-elems .crate"
74 assert-text: (".sidebar-elems .items > ul > li:nth-child(1)", "Functions")
75 assert-text: ("#functions + .item-table .item-left > a", "foo")