]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc-gui/sidebar.goml
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / rustdoc-gui / sidebar.goml
CommitLineData
5099ac24 1// Checks multiple things on the sidebar display (width of its elements, colors, etc).
2b03887a
FG
2goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
3assert-property: (".sidebar", {"clientWidth": "200"})
5099ac24
FG
4show-text: true
5local-storage: {"rustdoc-theme": "light"}
6// We reload the page so the local storage settings are being used.
7reload:
8
136023e0
XL
9assert-text: (".sidebar > .location", "Crate test_docs")
10// In modules, we only have one "location" element.
11assert-count: (".sidebar .location", 1)
2b03887a 12assert-count: (".sidebar h2", 1)
5099ac24
FG
13assert-text: ("#all-types", "All Items")
14assert-css: ("#all-types", {"color": "rgb(53, 109, 164)"})
136023e0 15// We check that we have the crates list and that the "current" on is "test_docs".
2b03887a 16assert-text: (".sidebar-elems ul.crate > li > a.current", "test_docs")
136023e0 17// And we're also supposed to have the list of items in the current module.
04454e1e
FG
18assert-text: (".sidebar-elems section ul > li:nth-child(1)", "Re-exports")
19assert-text: (".sidebar-elems section ul > li:nth-child(2)", "Modules")
20assert-text: (".sidebar-elems section ul > li:nth-child(3)", "Macros")
21assert-text: (".sidebar-elems section ul > li:nth-child(4)", "Structs")
22assert-text: (".sidebar-elems section ul > li:nth-child(5)", "Enums")
2b03887a
FG
23assert-text: (".sidebar-elems section ul > li:nth-child(6)", "Constants")
24assert-text: (".sidebar-elems section ul > li:nth-child(7)", "Traits")
25assert-text: (".sidebar-elems section ul > li:nth-child(8)", "Functions")
26assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Type Definitions")
27assert-text: (".sidebar-elems section ul > li:nth-child(10)", "Unions")
28assert-text: (".sidebar-elems section ul > li:nth-child(11)", "Keywords")
136023e0
XL
29assert-text: ("#structs + .item-table .item-left > a", "Foo")
30click: "#structs + .item-table .item-left > a"
31
32// PAGE: struct.Foo.html
2b03887a
FG
33assert-count: (".sidebar .location", 1)
34assert-count: (".sidebar h2", 2)
136023e0
XL
35// We check that there is no crate listed outside of the top level.
36assert-false: ".sidebar-elems > .crate"
5099ac24
FG
37
38click: ".sidebar-elems section .block li > a"
39assert-property-false: ("html", {"scrollTop": "0"})
40
41click: ".sidebar h2.location a"
42assert-property: ("html", {"scrollTop": "0"})
43
136023e0 44// We now go back to the crate page to click on the "lib2" crate link.
2b03887a
FG
45goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
46assert-property: (".sidebar", {"clientWidth": "200"})
47assert-css: (".sidebar-elems ul.crate > li:first-child > a", {"color": "rgb(53, 109, 164)"})
48click: ".sidebar-elems ul.crate > li:first-child > a"
136023e0
XL
49
50// PAGE: lib2/index.html
2b03887a
FG
51goto: "file://" + |DOC_PATH| + "/lib2/index.html"
52assert-property: (".sidebar", {"clientWidth": "200"})
136023e0
XL
53assert-text: (".sidebar > .location", "Crate lib2")
54// We check that we have the crates list and that the "current" on is now "lib2".
2b03887a 55assert-text: (".sidebar-elems ul.crate > li > a.current", "lib2")
136023e0 56// We now go to the "foobar" function page.
2b03887a
FG
57assert-text: (".sidebar-elems > section ul.block > li:nth-child(1)", "Modules")
58assert-text: (".sidebar-elems > section ul.block > li:nth-child(2)", "Structs")
59assert-text: (".sidebar-elems > section ul.block > li:nth-child(3)", "Traits")
60assert-text: (".sidebar-elems > section ul.block > li:nth-child(4)", "Functions")
61assert-text: (".sidebar-elems > section ul.block > li:nth-child(5)", "Type Definitions")
136023e0
XL
62assert-text: ("#functions + .item-table .item-left > a", "foobar")
63click: "#functions + .item-table .item-left > a"
64
65// PAGE: fn.foobar.html
2b03887a
FG
66// In items containing no items (like functions or constants) and in modules, we have no
67// "location" elements. Only the parent module h2.
68assert-count: (".sidebar .location", 0)
69assert-count: (".sidebar h2", 1)
70assert-text: (".sidebar .sidebar-elems h2", "In lib2")
136023e0
XL
71// We check that we don't have the crate list.
72assert-false: ".sidebar-elems > .crate"
73
2b03887a
FG
74goto: "./module/index.html"
75assert-property: (".sidebar", {"clientWidth": "200"})
136023e0
XL
76assert-text: (".sidebar > .location", "Module module")
77// We check that we don't have the crate list.
78assert-false: ".sidebar-elems > .crate"
79
2b03887a
FG
80goto: "./sub_module/sub_sub_module/index.html"
81assert-property: (".sidebar", {"clientWidth": "200"})
136023e0
XL
82assert-text: (".sidebar > .location", "Module sub_sub_module")
83// We check that we don't have the crate list.
3c0e092e 84assert-false: ".sidebar-elems .crate"
5099ac24 85assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions")
136023e0 86assert-text: ("#functions + .item-table .item-left > a", "foo")
5099ac24
FG
87
88// Links to trait implementations in the sidebar should not wrap even if they are long.
2b03887a
FG
89goto: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html"
90assert-property: (".sidebar", {"clientWidth": "200"})
5099ac24
FG
91assert-property: (".sidebar-elems section .block li > a", {"offsetHeight": 29})
92
93// Test that clicking on of the "In <module>" headings in the sidebar links to the
94// appropriate anchor in index.html.
2b03887a
FG
95goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
96assert-property: (".sidebar", {"clientWidth": "200"})
97click: "//ul[@class='block mod']/preceding-sibling::h3/a"
5099ac24
FG
98// PAGE: index.html
99assert-css: ("#modules", {"background-color": "rgb(253, 255, 211)"})
2b03887a
FG
100
101// Finally, assert that the `[+]/[−]` toggle doesn't affect sidebar width.
102click: "#toggle-all-docs"
103assert-text: ("#toggle-all-docs", "[+]")
104assert-property: (".sidebar", {"clientWidth": "200"})
105click: "#toggle-all-docs"
106assert-text: ("#toggle-all-docs", "[−]")
107assert-property: (".sidebar", {"clientWidth": "200"})