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"
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", "[+]")
11 "#main-content > details.top-doc > summary",
12 {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
14 click: "#toggle-all-docs"
15 // Not collapsed anymore so the "open" attribute should be back.
16 wait-for-attribute: ("#main-content > details.top-doc", {"open": ""})
17 assert-text: ("#toggle-all-docs", "[−]")
19 // Check that it works on non-module pages as well.
20 goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
21 // We first check that everything is visible.
22 assert-text: ("#toggle-all-docs", "[−]")
23 assert-attribute: ("#implementations-list details.rustdoc-toggle", {"open": ""}, ALL)
24 assert-attribute: ("#trait-implementations-list details.rustdoc-toggle", {"open": ""}, ALL)
25 assert-attribute-false: (
26 "#blanket-implementations-list > details.rustdoc-toggle",
31 // We collapse them all.
32 click: "#toggle-all-docs"
33 wait-for-text: ("#toggle-all-docs", "[+]")
34 // We check that all <details> are collapsed (except for the impl block ones).
35 assert-attribute-false: ("details.rustdoc-toggle:not(.implementors-toggle)", {"open": ""}, ALL)
36 assert-attribute: ("#implementations-list > details.implementors-toggle", {"open": ""})
37 // We now check that the other impl blocks are collapsed.
38 assert-attribute-false: (
39 "#blanket-implementations-list > details.rustdoc-toggle.implementors-toggle",
43 // We open them all again.
44 click: "#toggle-all-docs"
45 wait-for-text: ("#toggle-all-docs", "[−]")
46 assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)
48 // Checking the toggles style.
55 ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
56 // We reload the page so the local storage settings are being used.
59 ("assert-css", ("details.rustdoc-toggle > summary::before", {
63 ("move-cursor-to", "details.rustdoc-toggle summary"),
64 ("assert-css", ("details.rustdoc-toggle > summary:hover::before", {
68 // moving the cursor somewhere else to not mess with next function calls.
69 ("move-cursor-to", ".search-input"),
73 call-function: ("check-color", {"theme": "ayu", "filter": "invert(1)"})
74 call-function: ("check-color", {"theme": "dark", "filter": "invert(1)"})
75 call-function: ("check-color", {"theme": "light", "filter": "none"})