1
1
// Checks multiple things on the sidebar display (width of its elements, colors, etc).
2
2
goto: file://|DOC_PATH|/test_docs/index.html
3
+ assert-property: (".sidebar", {"clientWidth": "200"})
3
4
show-text: true
4
5
local-storage: {"rustdoc-theme": "light"}
5
6
// We reload the page so the local storage settings are being used.
@@ -39,11 +40,13 @@ assert-property: ("html", {"scrollTop": "0"})
39
40
40
41
// We now go back to the crate page to click on the "lib2" crate link.
41
42
goto: file://|DOC_PATH|/test_docs/index.html
43
+ assert-property: (".sidebar", {"clientWidth": "200"})
42
44
assert-css: (".sidebar-elems .crate > ul > li:first-child > a", {"color": "rgb(53, 109, 164)"})
43
45
click: ".sidebar-elems .crate > ul > li:first-child > a"
44
46
45
47
// PAGE: lib2/index.html
46
48
goto: file://|DOC_PATH|/lib2/index.html
49
+ assert-property: (".sidebar", {"clientWidth": "200"})
47
50
assert-text: (".sidebar > .location", "Crate lib2")
48
51
// We check that we have the crates list and that the "current" on is now "lib2".
49
52
assert-text: (".sidebar-elems .crate > ul > li > a.current", "lib2")
@@ -65,11 +68,13 @@ assert-text: (".sidebar .sidebar-elems .location", "In lib2")
65
68
assert-false: ".sidebar-elems > .crate"
66
69
67
70
goto: ./module/index.html
71
+ assert-property: (".sidebar", {"clientWidth": "200"})
68
72
assert-text: (".sidebar > .location", "Module module")
69
73
// We check that we don't have the crate list.
70
74
assert-false: ".sidebar-elems > .crate"
71
75
72
76
goto: ./sub_module/sub_sub_module/index.html
77
+ assert-property: (".sidebar", {"clientWidth": "200"})
73
78
assert-text: (".sidebar > .location", "Module sub_sub_module")
74
79
// We check that we don't have the crate list.
75
80
assert-false: ".sidebar-elems .crate"
@@ -78,11 +83,21 @@ assert-text: ("#functions + .item-table .item-left > a", "foo")
78
83
79
84
// Links to trait implementations in the sidebar should not wrap even if they are long.
80
85
goto: file://|DOC_PATH|/lib2/struct.HasALongTraitWithParams.html
86
+ assert-property: (".sidebar", {"clientWidth": "200"})
81
87
assert-property: (".sidebar-elems section .block li > a", {"offsetHeight": 29})
82
88
83
89
// Test that clicking on of the "In <module>" headings in the sidebar links to the
84
90
// appropriate anchor in index.html.
85
91
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
92
+ assert-property: (".sidebar", {"clientWidth": "200"})
86
93
click: ".block.mod h3 a"
87
94
// PAGE: index.html
88
95
assert-css: ("#modules", {"background-color": "rgb(253, 255, 211)"})
96
+
97
+ // Finally, assert that the `[+]/[−]` toggle doesn't affect sidebar width.
98
+ click: "#toggle-all-docs"
99
+ assert-text: ("#toggle-all-docs", "[+]")
100
+ assert-property: (".sidebar", {"clientWidth": "200"})
101
+ click: "#toggle-all-docs"
102
+ assert-text: ("#toggle-all-docs", "[−]")
103
+ assert-property: (".sidebar", {"clientWidth": "200"})
0 commit comments