2022-01-21 19:41:47 +00:00
|
|
|
|
// Checks that the documentation toggles have the correct position, style and work as expected.
|
2024-04-05 19:38:55 +00:00
|
|
|
|
include: "utils.goml"
|
2023-04-11 17:11:34 +00:00
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2021-11-29 16:14:05 +00:00
|
|
|
|
assert-attribute: ("#main-content > details.top-doc", {"open": ""})
|
2021-12-04 01:09:04 +00:00
|
|
|
|
assert-text: ("#toggle-all-docs", "[−]")
|
2021-02-21 13:25:12 +00:00
|
|
|
|
click: "#toggle-all-docs"
|
2022-02-19 13:46:37 +00:00
|
|
|
|
wait-for: 50
|
2021-05-11 18:56:07 +00:00
|
|
|
|
// This is now collapsed so there shouldn't be the "open" attribute on details.
|
2021-11-29 16:14:05 +00:00
|
|
|
|
assert-attribute-false: ("#main-content > details.top-doc", {"open": ""})
|
2021-12-04 01:09:04 +00:00
|
|
|
|
assert-text: ("#toggle-all-docs", "[+]")
|
2022-12-05 18:15:09 +00:00
|
|
|
|
assert-css: (
|
|
|
|
|
"#main-content > details.top-doc > summary",
|
|
|
|
|
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
|
|
|
|
|
)
|
2021-02-21 13:25:12 +00:00
|
|
|
|
click: "#toggle-all-docs"
|
2021-05-11 18:56:07 +00:00
|
|
|
|
// Not collapsed anymore so the "open" attribute should be back.
|
2022-03-21 14:50:05 +00:00
|
|
|
|
wait-for-attribute: ("#main-content > details.top-doc", {"open": ""})
|
2021-12-04 01:09:04 +00:00
|
|
|
|
assert-text: ("#toggle-all-docs", "[−]")
|
2022-02-19 13:46:37 +00:00
|
|
|
|
|
|
|
|
|
// Check that it works on non-module pages as well.
|
2023-04-11 17:11:34 +00:00
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
|
2022-02-19 13:46:37 +00:00
|
|
|
|
// We first check that everything is visible.
|
|
|
|
|
assert-text: ("#toggle-all-docs", "[−]")
|
2023-01-10 18:35:37 +00:00
|
|
|
|
assert-attribute: ("#implementations-list details.toggle", {"open": ""}, ALL)
|
|
|
|
|
assert-attribute: ("#trait-implementations-list details.toggle", {"open": ""}, ALL)
|
2022-03-08 16:52:31 +00:00
|
|
|
|
assert-attribute-false: (
|
2023-01-10 18:35:37 +00:00
|
|
|
|
"#blanket-implementations-list > details.toggle",
|
2022-03-08 16:52:31 +00:00
|
|
|
|
{"open": ""},
|
|
|
|
|
ALL,
|
|
|
|
|
)
|
|
|
|
|
|
2022-02-19 13:46:37 +00:00
|
|
|
|
// We collapse them all.
|
|
|
|
|
click: "#toggle-all-docs"
|
2022-03-21 14:50:05 +00:00
|
|
|
|
wait-for-text: ("#toggle-all-docs", "[+]")
|
2022-02-19 13:46:37 +00:00
|
|
|
|
// We check that all <details> are collapsed (except for the impl block ones).
|
2023-01-10 18:35:37 +00:00
|
|
|
|
assert-attribute-false: ("details.toggle:not(.implementors-toggle)", {"open": ""}, ALL)
|
2022-03-08 17:11:29 +00:00
|
|
|
|
assert-attribute: ("#implementations-list > details.implementors-toggle", {"open": ""})
|
2022-02-19 13:46:37 +00:00
|
|
|
|
// We now check that the other impl blocks are collapsed.
|
|
|
|
|
assert-attribute-false: (
|
2023-01-10 18:35:37 +00:00
|
|
|
|
"#blanket-implementations-list > details.toggle.implementors-toggle",
|
2022-02-19 13:46:37 +00:00
|
|
|
|
{"open": ""},
|
|
|
|
|
ALL,
|
|
|
|
|
)
|
|
|
|
|
// We open them all again.
|
|
|
|
|
click: "#toggle-all-docs"
|
2022-03-21 14:50:05 +00:00
|
|
|
|
wait-for-text: ("#toggle-all-docs", "[−]")
|
2023-01-10 18:35:37 +00:00
|
|
|
|
assert-attribute: ("details.toggle", {"open": ""}, ALL)
|
2022-12-01 14:58:16 +00:00
|
|
|
|
|
|
|
|
|
// Checking the toggles style.
|
|
|
|
|
show-text: true
|
|
|
|
|
define-function: (
|
|
|
|
|
"check-color",
|
2024-04-01 19:11:22 +00:00
|
|
|
|
[theme, filter],
|
2023-01-06 14:18:51 +00:00
|
|
|
|
block {
|
2024-04-05 19:38:55 +00:00
|
|
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
2022-12-01 14:58:16 +00:00
|
|
|
|
|
2023-01-10 18:35:37 +00:00
|
|
|
|
assert-css: ("details.toggle > summary::before", {
|
2022-12-01 14:58:16 +00:00
|
|
|
|
"opacity": "0.5",
|
|
|
|
|
"filter": |filter|,
|
2023-01-06 14:18:51 +00:00
|
|
|
|
}, ALL)
|
2023-01-10 18:35:37 +00:00
|
|
|
|
move-cursor-to: "details.toggle summary"
|
|
|
|
|
assert-css: ("details.toggle > summary:hover::before", {
|
2022-12-01 14:58:16 +00:00
|
|
|
|
"opacity": "1",
|
|
|
|
|
"filter": |filter|,
|
2023-01-06 14:18:51 +00:00
|
|
|
|
})
|
2022-12-01 14:58:16 +00:00
|
|
|
|
// moving the cursor somewhere else to not mess with next function calls.
|
2023-01-06 14:18:51 +00:00
|
|
|
|
move-cursor-to: ".search-input"
|
|
|
|
|
},
|
2022-12-01 14:58:16 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
call-function: ("check-color", {"theme": "ayu", "filter": "invert(1)"})
|
|
|
|
|
call-function: ("check-color", {"theme": "dark", "filter": "invert(1)"})
|
|
|
|
|
call-function: ("check-color", {"theme": "light", "filter": "none"})
|