]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/toggle-docs.goml
Rollup merge of #94749 - RalfJung:remove-dir-all-miri, r=cuviper
[rust.git] / src / test / rustdoc-gui / toggle-docs.goml
1 // Checks that the documentation toggles have the correct position, style and work as expected.
2 goto: file://|DOC_PATH|/test_docs/index.html
3 assert-attribute: ("#main-content > details.top-doc", {"open": ""})
4 assert-text: ("#toggle-all-docs", "[−]")
5 click: "#toggle-all-docs"
6 wait-for: 50
7 // This is now collapsed so there shouldn't be the "open" attribute on details.
8 assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
9 assert-text: ("#toggle-all-docs", "[+]")
10 click: "#toggle-all-docs"
11 wait-for: 50
12 // Not collapsed anymore so the "open" attribute should be back.
13 assert-attribute: ("#main-content > details.top-doc", {"open": ""})
14 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: ("#implementations-list details.rustdoc-toggle", {"open": ""}, ALL)
21 assert-attribute: ("#trait-implementations-list details.rustdoc-toggle", {"open": ""}, ALL)
22 assert-attribute-false: (
23     "#blanket-implementations-list > details.rustdoc-toggle",
24     {"open": ""},
25     ALL,
26 )
27
28 // We collapse them all.
29 click: "#toggle-all-docs"
30 wait-for: 50
31 assert-text: ("#toggle-all-docs", "[+]")
32 // We check that all <details> are collapsed (except for the impl block ones).
33 assert-attribute-false: ("details.rustdoc-toggle:not(.implementors-toggle)", {"open": ""}, ALL)
34 assert-attribute: ("#implementations-list > details.implementors-toggle", {"open": ""})
35 // We now check that the other impl blocks are collapsed.
36 assert-attribute-false: (
37     "#blanket-implementations-list > details.rustdoc-toggle.implementors-toggle",
38     {"open": ""},
39     ALL,
40 )
41 // We open them all again.
42 click: "#toggle-all-docs"
43 wait-for: 50
44 assert-text: ("#toggle-all-docs", "[−]")
45 assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)