Skip to content

Commit 70db59c

Browse files
Add GUI test for settings display
1 parent 5b6c593 commit 70db59c

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

src/test/rustdoc-gui/settings.goml

+60
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// This test ensures that the settings menu display is working as expected.
22
goto: file://|DOC_PATH|/test_docs/index.html
3+
show-text: true // needed when we check for colors below.
34
// First, we check that the settings page doesn't exist.
45
assert-false: "#settings"
56
// We now click on the settings button.
@@ -43,6 +44,65 @@ assert: ".setting-line.hidden #preferred-light-theme"
4344
// We check that the correct theme is selected.
4445
assert-property: ("#theme .choices #theme-dark", {"checked": "true"})
4546

47+
// Some style checks...
48+
// First we check the "default" display.
49+
assert-css: (
50+
"#theme-dark",
51+
{
52+
"border-color": "rgb(221, 221, 221)",
53+
"box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset",
54+
},
55+
)
56+
assert-css: ("#theme-light", {"border-color": "rgb(221, 221, 221)", "box-shadow": "none"})
57+
// Let's start with the hover.
58+
move-cursor-to: "#theme-dark"
59+
assert-css: (
60+
"#theme-dark",
61+
{
62+
"border-color": "rgb(33, 150, 243)",
63+
"box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset",
64+
},
65+
)
66+
move-cursor-to: "#theme-light"
67+
assert-css: ("#theme-light", {"border-color": "rgb(33, 150, 243)", "box-shadow": "none"})
68+
move-cursor-to: "#theme-ayu"
69+
// Let's now check with the focus.
70+
focus: "#theme-dark"
71+
assert-css: (
72+
"#theme-dark",
73+
{
74+
"border-color": "rgb(221, 221, 221)",
75+
"box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset, rgb(33, 150, 243) 0px 0px 2px 2px",
76+
},
77+
)
78+
focus: "#theme-light"
79+
assert-css: (
80+
"#theme-light",
81+
{
82+
"border-color": "rgb(221, 221, 221)",
83+
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
84+
},
85+
)
86+
// Now we check we both focus and hover.
87+
move-cursor-to: "#theme-dark"
88+
focus: "#theme-dark"
89+
assert-css: (
90+
"#theme-dark",
91+
{
92+
"border-color": "rgb(33, 150, 243)",
93+
"box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset, rgb(33, 150, 243) 0px 0px 2px 2px",
94+
},
95+
)
96+
move-cursor-to: "#theme-light"
97+
focus: "#theme-light"
98+
assert-css: (
99+
"#theme-light",
100+
{
101+
"border-color": "rgb(33, 150, 243)",
102+
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
103+
},
104+
)
105+
46106
// We now switch the display.
47107
click: "#use-system-theme"
48108
// Wait for the hidden element to show up.

0 commit comments

Comments
 (0)