Skip to content

Commit b01502a

Browse files
Extend GUI tests to check kbd colors
1 parent 18b45d8 commit b01502a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/test/rustdoc-gui/help-page.goml

+38
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,44 @@ assert-css: ("#help", {"display": "block"})
1313
compare-elements-property: (".sub", "#help", ["offsetWidth"])
1414
compare-elements-position: (".sub", "#help", ("x"))
1515

16+
// Checking the color of the elements of the help menu.
17+
show-text: true
18+
define-function: (
19+
"check-colors",
20+
(theme, color, background, box_shadow),
21+
[
22+
// Setting the theme.
23+
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
24+
// We reload the page so the local storage settings are being used.
25+
("reload"),
26+
("assert-css", ("#help kbd", {
27+
"color": |color|,
28+
"background-color": |background|,
29+
"box-shadow": |box_shadow| + " 0px -1px 0px 0px inset",
30+
"cursor": "default",
31+
}, ALL)),
32+
],
33+
)
34+
35+
call-function: ("check-colors", {
36+
"theme": "ayu",
37+
"color": "rgb(197, 197, 197)",
38+
"background": "rgb(49, 69, 89)",
39+
"box_shadow": "rgb(92, 103, 115)",
40+
})
41+
call-function: ("check-colors", {
42+
"theme": "dark",
43+
"color": "rgb(221, 221, 221)",
44+
"background": "rgb(250, 251, 252)",
45+
"box_shadow": "rgb(198, 203, 209)",
46+
})
47+
call-function: ("check-colors", {
48+
"theme": "light",
49+
"color": "rgb(0, 0, 0)",
50+
"background": "rgb(250, 251, 252)",
51+
"box_shadow": "rgb(198, 203, 209)",
52+
})
53+
1654
// This test ensures that opening the help popover without switching pages works.
1755
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
1856
size: (1000, 1000) // Only supported on desktop.

0 commit comments

Comments
 (0)