]>
Commit | Line | Data |
---|---|---|
5099ac24 | 1 | // Checks multiple things on the sidebar display (width of its elements, colors, etc). |
2b03887a FG |
2 | goto: "file://" + |DOC_PATH| + "/test_docs/index.html" |
3 | assert-property: (".sidebar", {"clientWidth": "200"}) | |
5099ac24 FG |
4 | show-text: true |
5 | local-storage: {"rustdoc-theme": "light"} | |
6 | // We reload the page so the local storage settings are being used. | |
7 | reload: | |
8 | ||
136023e0 XL |
9 | assert-text: (".sidebar > .location", "Crate test_docs") |
10 | // In modules, we only have one "location" element. | |
11 | assert-count: (".sidebar .location", 1) | |
2b03887a | 12 | assert-count: (".sidebar h2", 1) |
5099ac24 FG |
13 | assert-text: ("#all-types", "All Items") |
14 | assert-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 | 16 | assert-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 |
18 | assert-text: (".sidebar-elems section ul > li:nth-child(1)", "Re-exports") |
19 | assert-text: (".sidebar-elems section ul > li:nth-child(2)", "Modules") | |
20 | assert-text: (".sidebar-elems section ul > li:nth-child(3)", "Macros") | |
21 | assert-text: (".sidebar-elems section ul > li:nth-child(4)", "Structs") | |
22 | assert-text: (".sidebar-elems section ul > li:nth-child(5)", "Enums") | |
2b03887a FG |
23 | assert-text: (".sidebar-elems section ul > li:nth-child(6)", "Constants") |
24 | assert-text: (".sidebar-elems section ul > li:nth-child(7)", "Traits") | |
25 | assert-text: (".sidebar-elems section ul > li:nth-child(8)", "Functions") | |
26 | assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Type Definitions") | |
27 | assert-text: (".sidebar-elems section ul > li:nth-child(10)", "Unions") | |
28 | assert-text: (".sidebar-elems section ul > li:nth-child(11)", "Keywords") | |
136023e0 XL |
29 | assert-text: ("#structs + .item-table .item-left > a", "Foo") |
30 | click: "#structs + .item-table .item-left > a" | |
31 | ||
32 | // PAGE: struct.Foo.html | |
2b03887a FG |
33 | assert-count: (".sidebar .location", 1) |
34 | assert-count: (".sidebar h2", 2) | |
136023e0 XL |
35 | // We check that there is no crate listed outside of the top level. |
36 | assert-false: ".sidebar-elems > .crate" | |
5099ac24 FG |
37 | |
38 | click: ".sidebar-elems section .block li > a" | |
39 | assert-property-false: ("html", {"scrollTop": "0"}) | |
40 | ||
41 | click: ".sidebar h2.location a" | |
42 | assert-property: ("html", {"scrollTop": "0"}) | |
43 | ||
136023e0 | 44 | // We now go back to the crate page to click on the "lib2" crate link. |
2b03887a FG |
45 | goto: "file://" + |DOC_PATH| + "/test_docs/index.html" |
46 | assert-property: (".sidebar", {"clientWidth": "200"}) | |
47 | assert-css: (".sidebar-elems ul.crate > li:first-child > a", {"color": "rgb(53, 109, 164)"}) | |
48 | click: ".sidebar-elems ul.crate > li:first-child > a" | |
136023e0 XL |
49 | |
50 | // PAGE: lib2/index.html | |
2b03887a FG |
51 | goto: "file://" + |DOC_PATH| + "/lib2/index.html" |
52 | assert-property: (".sidebar", {"clientWidth": "200"}) | |
136023e0 XL |
53 | assert-text: (".sidebar > .location", "Crate lib2") |
54 | // We check that we have the crates list and that the "current" on is now "lib2". | |
2b03887a | 55 | assert-text: (".sidebar-elems ul.crate > li > a.current", "lib2") |
136023e0 | 56 | // We now go to the "foobar" function page. |
2b03887a FG |
57 | assert-text: (".sidebar-elems > section ul.block > li:nth-child(1)", "Modules") |
58 | assert-text: (".sidebar-elems > section ul.block > li:nth-child(2)", "Structs") | |
59 | assert-text: (".sidebar-elems > section ul.block > li:nth-child(3)", "Traits") | |
60 | assert-text: (".sidebar-elems > section ul.block > li:nth-child(4)", "Functions") | |
61 | assert-text: (".sidebar-elems > section ul.block > li:nth-child(5)", "Type Definitions") | |
136023e0 XL |
62 | assert-text: ("#functions + .item-table .item-left > a", "foobar") |
63 | click: "#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. | |
68 | assert-count: (".sidebar .location", 0) | |
69 | assert-count: (".sidebar h2", 1) | |
70 | assert-text: (".sidebar .sidebar-elems h2", "In lib2") | |
136023e0 XL |
71 | // We check that we don't have the crate list. |
72 | assert-false: ".sidebar-elems > .crate" | |
73 | ||
2b03887a FG |
74 | goto: "./module/index.html" |
75 | assert-property: (".sidebar", {"clientWidth": "200"}) | |
136023e0 XL |
76 | assert-text: (".sidebar > .location", "Module module") |
77 | // We check that we don't have the crate list. | |
78 | assert-false: ".sidebar-elems > .crate" | |
79 | ||
2b03887a FG |
80 | goto: "./sub_module/sub_sub_module/index.html" |
81 | assert-property: (".sidebar", {"clientWidth": "200"}) | |
136023e0 XL |
82 | assert-text: (".sidebar > .location", "Module sub_sub_module") |
83 | // We check that we don't have the crate list. | |
3c0e092e | 84 | assert-false: ".sidebar-elems .crate" |
5099ac24 | 85 | assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions") |
136023e0 | 86 | assert-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 |
89 | goto: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html" |
90 | assert-property: (".sidebar", {"clientWidth": "200"}) | |
5099ac24 FG |
91 | assert-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 |
95 | goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" |
96 | assert-property: (".sidebar", {"clientWidth": "200"}) | |
97 | click: "//ul[@class='block mod']/preceding-sibling::h3/a" | |
5099ac24 FG |
98 | // PAGE: index.html |
99 | assert-css: ("#modules", {"background-color": "rgb(253, 255, 211)"}) | |
2b03887a FG |
100 | |
101 | // Finally, assert that the `[+]/[−]` toggle doesn't affect sidebar width. | |
102 | click: "#toggle-all-docs" | |
103 | assert-text: ("#toggle-all-docs", "[+]") | |
104 | assert-property: (".sidebar", {"clientWidth": "200"}) | |
105 | click: "#toggle-all-docs" | |
106 | assert-text: ("#toggle-all-docs", "[−]") | |
107 | assert-property: (".sidebar", {"clientWidth": "200"}) |