]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/sidebar.goml
Rollup merge of #95475 - Jules-Bertholet:rustdoc-hide-assoc-consts-from-trait-impls...
[rust.git] / src / test / rustdoc-gui / sidebar.goml
1 // Checks multiple things on the sidebar display (width of its elements, colors, etc).
2 goto: file://|DOC_PATH|/test_docs/index.html
3 show-text: true
4 local-storage: {"rustdoc-theme": "light"}
5 // We reload the page so the local storage settings are being used.
6 reload:
7
8 assert-text: (".sidebar > .location", "Crate test_docs")
9 // In modules, we only have one "location" element.
10 assert-count: (".sidebar .location", 1)
11 assert-text: ("#all-types", "All Items")
12 assert-css: ("#all-types", {"color": "rgb(53, 109, 164)"})
13 // We check that we have the crates list and that the "current" on is "test_docs".
14 assert-text: (".sidebar-elems .crate > ul > li > a.current", "test_docs")
15 // And we're also supposed to have the list of items in the current module.
16 assert-text: (".sidebar-elems section ul > li:nth-child(1)", "Modules")
17 assert-text: (".sidebar-elems section ul > li:nth-child(2)", "Macros")
18 assert-text: (".sidebar-elems section ul > li:nth-child(3)", "Structs")
19 assert-text: (".sidebar-elems section ul > li:nth-child(4)", "Enums")
20 assert-text: (".sidebar-elems section ul > li:nth-child(5)", "Traits")
21 assert-text: (".sidebar-elems section ul > li:nth-child(6)", "Functions")
22 assert-text: (".sidebar-elems section ul > li:nth-child(7)", "Type Definitions")
23 assert-text: (".sidebar-elems section ul > li:nth-child(8)", "Unions")
24 assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Keywords")
25 assert-text: ("#structs + .item-table .item-left > a", "Foo")
26 click: "#structs + .item-table .item-left > a"
27
28 // PAGE: struct.Foo.html
29 assert-count: (".sidebar .location", 2)
30 // We check that there is no crate listed outside of the top level.
31 assert-false: ".sidebar-elems > .crate"
32
33 click: ".sidebar-elems section .block li > a"
34 assert-property-false: ("html", {"scrollTop": "0"})
35
36 click: ".sidebar h2.location a"
37 assert-property: ("html", {"scrollTop": "0"})
38
39 // We now go back to the crate page to click on the "lib2" crate link.
40 goto: file://|DOC_PATH|/test_docs/index.html
41 assert-css: (".sidebar-elems .crate > ul > li:first-child > a", {"color": "rgb(53, 109, 164)"})
42 click: ".sidebar-elems .crate > ul > li:first-child > a"
43
44 // PAGE: lib2/index.html
45 goto: file://|DOC_PATH|/lib2/index.html
46 assert-text: (".sidebar > .location", "Crate lib2")
47 // We check that we have the crates list and that the "current" on is now "lib2".
48 assert-text: (".sidebar-elems .crate > ul > li > a.current", "lib2")
49 // We now go to the "foobar" function page.
50 assert-text: (".sidebar-elems > section .block ul > li:nth-child(1)", "Modules")
51 assert-text: (".sidebar-elems > section .block ul > li:nth-child(2)", "Structs")
52 assert-text: (".sidebar-elems > section .block ul > li:nth-child(3)", "Traits")
53 assert-text: (".sidebar-elems > section .block ul > li:nth-child(4)", "Functions")
54 assert-text: (".sidebar-elems > section .block ul > li:nth-child(5)", "Type Definitions")
55 assert-text: ("#functions + .item-table .item-left > a", "foobar")
56 click: "#functions + .item-table .item-left > a"
57
58 // PAGE: fn.foobar.html
59 // In items containing no items (like functions or constants) and in modules, we have one
60 // "location" elements.
61 assert-count: (".sidebar .location", 1)
62 assert-text: (".sidebar .sidebar-elems .location", "In lib2")
63 // We check that we don't have the crate list.
64 assert-false: ".sidebar-elems > .crate"
65
66 goto: ./module/index.html
67 assert-text: (".sidebar > .location", "Module module")
68 // We check that we don't have the crate list.
69 assert-false: ".sidebar-elems > .crate"
70
71 goto: ./sub_module/sub_sub_module/index.html
72 assert-text: (".sidebar > .location", "Module sub_sub_module")
73 // We check that we don't have the crate list.
74 assert-false: ".sidebar-elems .crate"
75 assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions")
76 assert-text: ("#functions + .item-table .item-left > a", "foo")
77
78 // Links to trait implementations in the sidebar should not wrap even if they are long.
79 goto: file://|DOC_PATH|/lib2/struct.HasALongTraitWithParams.html
80 assert-property: (".sidebar-elems section .block li > a", {"offsetHeight": 29})
81
82 // Test that clicking on of the "In <module>" headings in the sidebar links to the
83 // appropriate anchor in index.html.
84 goto: file://|DOC_PATH|/test_docs/struct.Foo.html
85 click: ".block.mod h3 a"
86 // PAGE: index.html
87 assert-css: ("#modules", {"background-color": "rgb(253, 255, 211)"})