Skip to content

Commit 269dad2

Browse files
committed
rustdoc: add test cases for checkbox toggles
1 parent 0f3ae62 commit 269dad2

File tree

1 file changed

+79
-4
lines changed

1 file changed

+79
-4
lines changed

src/test/rustdoc-gui/settings.goml

+79-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ assert: ".setting-line.hidden #preferred-light-theme"
4848
assert-property: ("#theme .choices #theme-dark", {"checked": "true"})
4949

5050
// Some style checks...
51-
// First we check the "default" display.
51+
move-cursor-to: "#settings-menu > a"
52+
// First we check the "default" display for radio buttons.
5253
assert-css: (
5354
"#theme-dark",
5455
{
@@ -57,7 +58,7 @@ assert-css: (
5758
},
5859
)
5960
assert-css: ("#theme-light", {"border-color": "rgb(221, 221, 221)", "box-shadow": "none"})
60-
// Let's start with the hover.
61+
// Let's start with the hover for radio buttons.
6162
move-cursor-to: "#theme-dark"
6263
assert-css: (
6364
"#theme-dark",
@@ -69,7 +70,7 @@ assert-css: (
6970
move-cursor-to: "#theme-light"
7071
assert-css: ("#theme-light", {"border-color": "rgb(33, 150, 243)", "box-shadow": "none"})
7172
move-cursor-to: "#theme-ayu"
72-
// Let's now check with the focus.
73+
// Let's now check with the focus for radio buttons.
7374
focus: "#theme-dark"
7475
assert-css: (
7576
"#theme-dark",
@@ -86,7 +87,7 @@ assert-css: (
8687
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
8788
},
8889
)
89-
// Now we check we both focus and hover.
90+
// Now we check we both focus and hover for radio buttons.
9091
move-cursor-to: "#theme-dark"
9192
focus: "#theme-dark"
9293
assert-css: (
@@ -106,6 +107,80 @@ assert-css: (
106107
},
107108
)
108109

110+
// First we check the "default" display for toggles.
111+
assert-css: (
112+
"#auto-hide-large-items",
113+
{
114+
"background-color": "rgb(33, 150, 243)",
115+
"border-color": "rgb(221, 221, 221)",
116+
},
117+
)
118+
assert-css: (
119+
"#use-system-theme",
120+
{
121+
"background-color": "rgba(0, 0, 0, 0)",
122+
"border-color": "rgb(221, 221, 221)",
123+
}
124+
)
125+
// Let's start with the hover for toggles.
126+
move-cursor-to: "#auto-hide-large-items"
127+
assert-css: (
128+
"#auto-hide-large-items",
129+
{
130+
"background-color": "rgb(33, 150, 243)",
131+
"border-color": "rgb(33, 150, 243)",
132+
},
133+
)
134+
move-cursor-to: "#use-system-theme"
135+
assert-css: (
136+
"#use-system-theme",
137+
{
138+
"background-color": "rgba(0, 0, 0, 0)",
139+
"border-color": "rgb(33, 150, 243)",
140+
}
141+
)
142+
move-cursor-to: "#settings-menu > a"
143+
// Let's now check with the focus for toggles.
144+
focus: "#auto-hide-large-items"
145+
assert-css: (
146+
"#auto-hide-large-items",
147+
{
148+
"background-color": "rgb(33, 150, 243)",
149+
"border-color": "rgb(221, 221, 221)",
150+
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
151+
},
152+
)
153+
focus: "#use-system-theme"
154+
assert-css: (
155+
"#use-system-theme",
156+
{
157+
"background-color": "rgba(0, 0, 0, 0)",
158+
"border-color": "rgb(221, 221, 221)",
159+
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
160+
},
161+
)
162+
// Now we check we both focus and hover for toggles.
163+
move-cursor-to: "#auto-hide-large-items"
164+
focus: "#auto-hide-large-items"
165+
assert-css: (
166+
"#auto-hide-large-items",
167+
{
168+
"background-color": "rgb(33, 150, 243)",
169+
"border-color": "rgb(33, 150, 243)",
170+
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
171+
},
172+
)
173+
move-cursor-to: "#use-system-theme"
174+
focus: "#use-system-theme"
175+
assert-css: (
176+
"#use-system-theme",
177+
{
178+
"background-color": "rgba(0, 0, 0, 0)",
179+
"border-color": "rgb(33, 150, 243)",
180+
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
181+
},
182+
)
183+
109184
// We now switch the display.
110185
click: "#use-system-theme"
111186
// Wait for the hidden element to show up.

0 commit comments

Comments
 (0)