@@ -29,170 +29,95 @@ assert-local-storage: {"rustdoc-source-sidebar-show": "true"}
2929// Now we check the display of the sidebar items.
3030show-text: true
3131
32- // First we start with the light theme.
33- local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
34- reload:
35- // Waiting for the sidebar to be displayed...
36- wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
37- assert-css: (
38- "#source-sidebar details[open] > .files a.selected",
39- {"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"},
40- )
41- // Without hover or focus.
42- assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
43- // With focus.
44- focus: "#sidebar-toggle > button"
45- assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(224, 224, 224)"})
46- focus: ".search-input"
47- // With hover.
48- move-cursor-to: "#sidebar-toggle > button"
49- assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(224, 224, 224)"})
50- // Without hover.
51- assert-css: (
52- "#source-sidebar details[open] > .files a:not(.selected)",
53- {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
54- )
55- // With focus.
56- focus: "#source-sidebar details[open] > .files a:not(.selected)"
57- wait-for-css: (
58- "#source-sidebar details[open] > .files a:not(.selected)",
59- {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
60- )
61- focus: ".search-input"
62- // With hover.
63- move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
64- assert-css: (
65- "#source-sidebar details[open] > .files a:not(.selected)",
66- {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
67- )
68- // Without hover.
69- assert-css: (
70- "#source-sidebar details[open] > .folders > details > summary",
71- {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
72- )
73- // With focus.
74- focus: "#source-sidebar details[open] > .folders > details > summary"
75- wait-for-css: (
76- "#source-sidebar details[open] > .folders > details > summary",
77- {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
78- )
79- focus: ".search-input"
80- // With hover.
81- move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
82- assert-css: (
83- "#source-sidebar details[open] > .folders > details > summary",
84- {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
32+ define-function: (
33+ "check-colors",
34+ (
35+ theme, color, color_hover, background, background_hover, background_toggle,
36+ background_toggle_hover,
37+ ),
38+ [
39+ ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
40+ ("reload"),
41+ ("wait-for-css", ("#sidebar-toggle", {"visibility": "visible"})),
42+ ("assert-css", (
43+ "#source-sidebar details[open] > .files a.selected",
44+ {"color": |color_hover|, "background-color": |background|},
45+ )),
46+ // Without hover or focus.
47+ ("assert-css", ("#sidebar-toggle > button", {"background-color": |background_toggle|})),
48+ // With focus.
49+ ("focus", "#sidebar-toggle > button"),
50+ ("assert-css", ("#sidebar-toggle > button", {"background-color": |background_toggle_hover|})),
51+ ("focus", ".search-input"),
52+ // With hover.
53+ ("move-cursor-to", "#sidebar-toggle > button"),
54+ ("assert-css", ("#sidebar-toggle > button", {"background-color": |background_toggle_hover|})),
55+ // Without hover.
56+ ("assert-css", (
57+ "#source-sidebar details[open] > .files a:not(.selected)",
58+ {"color": |color|, "background-color": |background_toggle|},
59+ )),
60+ // With focus.
61+ ("focus", "#source-sidebar details[open] > .files a:not(.selected)"),
62+ ("wait-for-css", (
63+ "#source-sidebar details[open] > .files a:not(.selected)",
64+ {"color": |color_hover|, "background-color": |background_hover|},
65+ )),
66+ ("focus", ".search-input"),
67+ // With hover.
68+ ("move-cursor-to", "#source-sidebar details[open] > .files a:not(.selected)"),
69+ ("assert-css", (
70+ "#source-sidebar details[open] > .files a:not(.selected)",
71+ {"color": |color_hover|, "background-color": |background_hover|},
72+ )),
73+ // Without hover.
74+ ("assert-css", (
75+ "#source-sidebar details[open] > .folders > details > summary",
76+ {"color": |color|, "background-color": |background_toggle|},
77+ )),
78+ // With focus.
79+ ("focus", "#source-sidebar details[open] > .folders > details > summary"),
80+ ("wait-for-css", (
81+ "#source-sidebar details[open] > .folders > details > summary",
82+ {"color": |color_hover|, "background-color": |background_hover|},
83+ )),
84+ ("focus", ".search-input"),
85+ // With hover.
86+ ("move-cursor-to", "#source-sidebar details[open] > .folders > details > summary"),
87+ ("assert-css", (
88+ "#source-sidebar details[open] > .folders > details > summary",
89+ {"color": |color_hover|, "background-color": |background_hover|},
90+ )),
91+ ],
8592)
8693
87- // Now with the dark theme.
88- local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
89- reload:
90- // Waiting for the sidebar to be displayed...
91- wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
92- assert-css: (
93- "#source-sidebar details[open] > .files > a.selected",
94- {"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"},
95- )
96- // Without hover or focus.
97- assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
98- // With focus.
99- focus: "#sidebar-toggle > button"
100- assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(103, 103, 103)"})
101- focus: ".search-input"
102- // With hover.
103- move-cursor-to: "#sidebar-toggle > button"
104- assert-css: ("#sidebar-toggle > button", {"background-color": "rgb(103, 103, 103)"})
105- // Without hover.
106- assert-css: (
107- "#source-sidebar details[open] > .files > a:not(.selected)",
108- {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
109- )
110- // With focus.
111- focus: "#source-sidebar details[open] > .files a:not(.selected)"
112- wait-for-css: (
113- "#source-sidebar details[open] > .files a:not(.selected)",
114- {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
115- )
116- focus: ".search-input"
117- // With hover.
118- move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
119- assert-css: (
120- "#source-sidebar details[open] > .files a:not(.selected)",
121- {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
122- )
123- // Without hover.
124- assert-css: (
125- "#source-sidebar details[open] > .folders > details > summary",
126- {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
127- )
128- // With focus.
129- focus: "#source-sidebar details[open] > .folders > details > summary"
130- wait-for-css: (
131- "#source-sidebar details[open] > .folders > details > summary",
132- {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
133- )
134- focus: ".search-input"
135- // With hover.
136- move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
137- assert-css: (
138- "#source-sidebar details[open] > .folders > details > summary",
139- {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
140- )
141-
142- // And finally with the ayu theme.
143- local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
144- reload:
145- // Waiting for the sidebar to be displayed...
146- wait-for-css: ("#sidebar-toggle", {"visibility": "visible"})
147- assert-css: (
148- "#source-sidebar details[open] > .files a.selected",
149- {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
150- )
151- // Without hover or focus.
152- assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(0, 0, 0, 0)"})
153- // With focus.
154- focus: "#sidebar-toggle > button"
155- assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(70, 70, 70, 0.33)"})
156- focus: ".search-input"
157- // With hover.
158- move-cursor-to: "#sidebar-toggle > button"
159- assert-css: ("#sidebar-toggle > button", {"background-color": "rgba(70, 70, 70, 0.33)"})
160- // Without hover.
161- assert-css: (
162- "#source-sidebar details[open] > .files a:not(.selected)",
163- {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
164- )
165- // With focus.
166- focus: "#source-sidebar details[open] > .files a:not(.selected)"
167- wait-for-css: (
168- "#source-sidebar details[open] > .files a:not(.selected)",
169- {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
170- )
171- focus: ".search-input"
172- // With hover.
173- move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
174- assert-css: (
175- "#source-sidebar details[open] > .files a:not(.selected)",
176- {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
177- )
178- // Without hover.
179- assert-css: (
180- "#source-sidebar details[open] > .folders > details > summary",
181- {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
182- )
183- // With focus.
184- focus: "#source-sidebar details[open] > .folders > details > summary"
185- wait-for-css: (
186- "#source-sidebar details[open] > .folders > details > summary",
187- {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
188- )
189- focus: ".search-input"
190- // With hover.
191- move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
192- assert-css: (
193- "#source-sidebar details[open] > .folders > details > summary",
194- {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
195- )
94+ call-function: ("check-colors", {
95+ "theme": "light",
96+ "color": "rgb(0, 0, 0)",
97+ "color_hover": "rgb(0, 0, 0)",
98+ "background": "rgb(255, 255, 255)",
99+ "background_hover": "rgb(224, 224, 224)",
100+ "background_toggle": "rgba(0, 0, 0, 0)",
101+ "background_toggle_hover": "rgb(224, 224, 224)",
102+ })
103+ call-function: ("check-colors", {
104+ "theme": "dark",
105+ "color": "rgb(221, 221, 221)",
106+ "color_hover": "rgb(221, 221, 221)",
107+ "background": "rgb(51, 51, 51)",
108+ "background_hover": "rgb(68, 68, 68)",
109+ "background_toggle": "rgba(0, 0, 0, 0)",
110+ "background_toggle_hover": "rgb(103, 103, 103)",
111+ })
112+ call-function: ("check-colors", {
113+ "theme": "ayu",
114+ "color": "rgb(197, 197, 197)",
115+ "color_hover": "rgb(255, 180, 76)",
116+ "background": "rgb(20, 25, 31)",
117+ "background_hover": "rgb(20, 25, 31)",
118+ "background_toggle": "rgba(0, 0, 0, 0)",
119+ "background_toggle_hover": "rgba(70, 70, 70, 0.33)",
120+ })
196121
197122// Now checking on mobile devices.
198123size: (500, 700)
0 commit comments