Skip to content

Commit 188f31e

Browse files
Add GUI test for toggle filter and opacity
1 parent f76c4b8 commit 188f31e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/test/rustdoc-gui/toggle-docs.goml

+29
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,32 @@ assert-attribute-false: (
4040
click: "#toggle-all-docs"
4141
wait-for-text: ("#toggle-all-docs", "[−]")
4242
assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL)
43+
44+
// Checking the toggles style.
45+
show-text: true
46+
define-function: (
47+
"check-color",
48+
(theme, filter),
49+
[
50+
// Setting the theme.
51+
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
52+
// We reload the page so the local storage settings are being used.
53+
("reload"),
54+
55+
("assert-css", ("details.rustdoc-toggle > summary::before", {
56+
"opacity": "0.5",
57+
"filter": |filter|,
58+
}, ALL)),
59+
("move-cursor-to", "details.rustdoc-toggle summary"),
60+
("assert-css", ("details.rustdoc-toggle > summary:hover::before", {
61+
"opacity": "1",
62+
"filter": |filter|,
63+
})),
64+
// moving the cursor somewhere else to not mess with next function calls.
65+
("move-cursor-to", ".search-input"),
66+
]
67+
)
68+
69+
call-function: ("check-color", {"theme": "ayu", "filter": "invert(1)"})
70+
call-function: ("check-color", {"theme": "dark", "filter": "invert(1)"})
71+
call-function: ("check-color", {"theme": "light", "filter": "none"})

0 commit comments

Comments
 (0)