Skip to content

Commit ec50cdb

Browse files
Extend toggle GUI test a bit
1 parent b8967b0 commit ec50cdb

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

Diff for: src/test/rustdoc-gui/toggle-docs.goml

+26-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,36 @@ goto: file://|DOC_PATH|/test_docs/index.html
33
assert-attribute: ("#main-content > details.top-doc", {"open": ""})
44
assert-text: ("#toggle-all-docs", "[−]")
55
click: "#toggle-all-docs"
6-
wait-for: 1000
6+
wait-for: 50
77
// This is now collapsed so there shouldn't be the "open" attribute on details.
88
assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
99
assert-text: ("#toggle-all-docs", "[+]")
1010
click: "#toggle-all-docs"
11-
wait-for: 1000
11+
wait-for: 50
1212
// Not collapsed anymore so the "open" attribute should be back.
1313
assert-attribute: ("#main-content > details.top-doc", {"open": ""})
1414
assert-text: ("#toggle-all-docs", "[−]")
15+
16+
// Check that it works on non-module pages as well.
17+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
18+
// We first check that everything is visible.
19+
assert-text: ("#toggle-all-docs", "[−]")
20+
assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)
21+
// We collapse them all.
22+
click: "#toggle-all-docs"
23+
wait-for: 50
24+
assert-text: ("#toggle-all-docs", "[+]")
25+
// We check that all <details> are collapsed (except for the impl block ones).
26+
assert-attribute-false: ("details.rustdoc-toggle:not(.implementors-toggle)", {"open": ""}, ALL)
27+
assert-attribute: ("details.rustdoc-toggle.implementors-toggle", {"open": ""})
28+
// We now check that the other impl blocks are collapsed.
29+
assert-attribute-false: (
30+
"#blanket-implementations-list > details.rustdoc-toggle.implementors-toggle",
31+
{"open": ""},
32+
ALL,
33+
)
34+
// We open them all again.
35+
click: "#toggle-all-docs"
36+
wait-for: 50
37+
assert-text: ("#toggle-all-docs", "[−]")
38+
assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)

0 commit comments

Comments
 (0)