Add GUI test for toggle filter and opacity

This commit is contained in:
Guillaume Gomez 2022-12-01 15:58:16 +01:00
parent f76c4b84c9
commit 188f31eba0

View File

@ -40,3 +40,32 @@ assert-attribute-false: (
click: "#toggle-all-docs"
wait-for-text: ("#toggle-all-docs", "[]")
assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)
// Checking the toggles style.
show-text: true
define-function: (
"check-color",
(theme, filter),
[
// Setting the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
// We reload the page so the local storage settings are being used.
("reload"),
("assert-css", ("details.rustdoc-toggle > summary::before", {
"opacity": "0.5",
"filter": |filter|,
}, ALL)),
("move-cursor-to", "details.rustdoc-toggle summary"),
("assert-css", ("details.rustdoc-toggle > summary:hover::before", {
"opacity": "1",
"filter": |filter|,
})),
// moving the cursor somewhere else to not mess with next function calls.
("move-cursor-to", ".search-input"),
]
)
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"})