]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/toggle-docs.goml
Rollup merge of #95352 - jyn514:full-relative-path, r=Mark-Simulacrum
[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 // Not collapsed anymore so the "open" attribute should be back.
12 wait-for-attribute: ("#main-content > details.top-doc", {"open": ""})
13 assert-text: ("#toggle-all-docs", "[−]")
14
15 // Check that it works on non-module pages as well.
16 goto: file://|DOC_PATH|/test_docs/struct.Foo.html
17 // We first check that everything is visible.
18 assert-text: ("#toggle-all-docs", "[−]")
19 assert-attribute: ("#implementations-list details.rustdoc-toggle", {"open": ""}, ALL)
20 assert-attribute: ("#trait-implementations-list details.rustdoc-toggle", {"open": ""}, ALL)
21 assert-attribute-false: (
22     "#blanket-implementations-list > details.rustdoc-toggle",
23     {"open": ""},
24     ALL,
25 )
26
27 // We collapse them all.
28 click: "#toggle-all-docs"
29 wait-for-text: ("#toggle-all-docs", "[+]")
30 // We check that all <details> are collapsed (except for the impl block ones).
31 assert-attribute-false: ("details.rustdoc-toggle:not(.implementors-toggle)", {"open": ""}, ALL)
32 assert-attribute: ("#implementations-list > details.implementors-toggle", {"open": ""})
33 // We now check that the other impl blocks are collapsed.
34 assert-attribute-false: (
35     "#blanket-implementations-list > details.rustdoc-toggle.implementors-toggle",
36     {"open": ""},
37     ALL,
38 )
39 // We open them all again.
40 click: "#toggle-all-docs"
41 wait-for-text: ("#toggle-all-docs", "[−]")
42 assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)