@@ -48,7 +48,8 @@ assert: ".setting-line.hidden #preferred-light-theme"
4848assert-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.
5253assert-css: (
5354 "#theme-dark",
5455 {
@@ -57,7 +58,7 @@ assert-css: (
5758 },
5859)
5960assert-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 .
6162move-cursor-to: "#theme-dark"
6263assert-css: (
6364 "#theme-dark",
@@ -69,7 +70,7 @@ assert-css: (
6970move-cursor-to: "#theme-light"
7071assert-css: ("#theme-light", {"border-color": "rgb(33, 150, 243)", "box-shadow": "none"})
7172move-cursor-to: "#theme-ayu"
72- // Let's now check with the focus.
73+ // Let's now check with the focus for radio buttons .
7374focus: "#theme-dark"
7475assert-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 .
9091move-cursor-to: "#theme-dark"
9192focus: "#theme-dark"
9293assert-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.
110185click: "#use-system-theme"
111186// Wait for the hidden element to show up.
@@ -118,7 +193,7 @@ assert: ".setting-line.hidden #theme"
118193assert-text: ("#preferred-dark-theme .setting-name", "Preferred dark theme")
119194assert-text: ("#preferred-light-theme .setting-name", "Preferred light theme")
120195
121- // We now check that clicking on the "sliders" ' text is like clicking on the slider .
196+ // We now check that clicking on the toggles ' text is like clicking on the checkbox .
122197// To test it, we use the "Disable keyboard shortcuts".
123198local-storage: {"rustdoc-disable-shortcuts": "false"}
124199click: ".setting-line:last-child .toggle .label"
@@ -141,10 +216,7 @@ assert-css: ("#settings-menu .popover", {"display": "none"})
141216// Now we go to the settings page to check that the CSS is loaded as expected.
142217goto: "file://" + |DOC_PATH| + "/settings.html"
143218wait-for: "#settings"
144- assert-css: (
145- ".setting-line .toggle .slider",
146- {"width": "45px", "margin-right": "20px", "border": "0px none rgb(0, 0, 0)"},
147- )
219+ assert-css: (".setting-line", {"position": "relative"})
148220
149221assert-attribute-false: ("#settings", {"class": "popover"}, CONTAINS)
150222compare-elements-position: (".sub form", "#settings", ("x"))
@@ -162,4 +234,4 @@ reload:
162234size: (300, 1000)
163235click: "#settings-menu"
164236wait-for: "#settings"
165- assert-css: ("#settings .slider ", {"width ": "45px"}, ALL )
237+ assert-css: (".setting-line ", {"position ": "relative"} )
0 commit comments