fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// Checks that the documentation toggles have the correct position, style and work as expected. 2go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" 3assert-attribute: ("#main-content > details.top-doc", {"open": ""}) 4assert-text: ("#toggle-all-docs", "[−]") 5click: "#toggle-all-docs" 6wait-for: 50 7// This is now collapsed so there shouldn't be the "open" attribute on details. 8assert-attribute-false: ("#main-content > details.top-doc", {"open": ""}) 9assert-text: ("#toggle-all-docs", "[+]") 10assert-css: ( 11 "#main-content > details.top-doc > summary", 12 {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'}, 13) 14click: "#toggle-all-docs" 15// Not collapsed anymore so the "open" attribute should be back. 16wait-for-attribute: ("#main-content > details.top-doc", {"open": ""}) 17assert-text: ("#toggle-all-docs", "[−]") 18 19// Check that it works on non-module pages as well. 20go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" 21// We first check that everything is visible. 22assert-text: ("#toggle-all-docs", "[−]") 23assert-attribute: ("#implementations-list details.toggle", {"open": ""}, ALL) 24assert-attribute: ("#trait-implementations-list details.toggle", {"open": ""}, ALL) 25assert-attribute-false: ( 26 "#blanket-implementations-list > details.toggle", 27 {"open": ""}, 28 ALL, 29) 30 31// We collapse them all. 32click: "#toggle-all-docs" 33wait-for-text: ("#toggle-all-docs", "[+]") 34// We check that all <details> are collapsed (except for the impl block ones). 35assert-attribute-false: ("details.toggle:not(.implementors-toggle)", {"open": ""}, ALL) 36assert-attribute: ("#implementations-list > details.implementors-toggle", {"open": ""}) 37// We now check that the other impl blocks are collapsed. 38assert-attribute-false: ( 39 "#blanket-implementations-list > details.toggle.implementors-toggle", 40 {"open": ""}, 41 ALL, 42) 43// We open them all again. 44click: "#toggle-all-docs" 45wait-for-text: ("#toggle-all-docs", "[−]") 46assert-attribute: ("details.toggle", {"open": ""}, ALL) 47 48// Checking the toggles style. 49show-text: true 50define-function: ( 51 "check-color", 52 (theme, filter), 53 block { 54 // Setting the theme. 55 set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} 56 // We reload the page so the local storage settings are being used. 57 reload: 58 59 assert-css: ("details.toggle > summary::before", { 60 "opacity": "0.5", 61 "filter": |filter|, 62 }, ALL) 63 move-cursor-to: "details.toggle summary" 64 assert-css: ("details.toggle > summary:hover::before", { 65 "opacity": "1", 66 "filter": |filter|, 67 }) 68 // moving the cursor somewhere else to not mess with next function calls. 69 move-cursor-to: ".search-input" 70 }, 71) 72 73call-function: ("check-color", {"theme": "ayu", "filter": "invert(1)"}) 74call-function: ("check-color", {"theme": "dark", "filter": "invert(1)"}) 75call-function: ("check-color", {"theme": "light", "filter": "none"})