1 // The goal of this test is to ensure the color of the text is the one expected.
5 (result_kind, color, hover_color),
9 (".result-" + |result_kind| + " ." + |result_kind|, {"color": |color|}, ALL),
14 ".result-" + |result_kind|,
15 {"color": |entry_color|, "background-color": |background_color|},
20 ".result-" + |result_kind|,
25 ".result-" + |result_kind| + ":hover",
26 {"color": |hover_entry_color|, "background-color": |hover_background_color|},
31 (".result-" + |result_kind| + ":hover ." + |result_kind|, {"color": |hover_color|}),
39 ".result-" + |result_kind|,
44 ".result-" + |result_kind| + ":focus",
45 {"color": |hover_entry_color|, "background-color": |hover_background_color|},
50 (".result-" + |result_kind| + ":focus ." + |result_kind|, {"color": |hover_color|}),
55 goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo"
57 // This is needed so that the text color is computed.
62 "rustdoc-theme": "ayu",
63 "rustdoc-use-system-theme": "false",
67 // Waiting for the search results to appear...
70 "//*[@class='desc']//*[text()='Just a normal struct.']",
71 {"color": "rgb(197, 197, 197)"},
74 "//*[@class='result-name']/*[text()='test_docs::']",
75 {"color": "rgb(0, 150, 207)"},
78 // Checking the color of "keyword" text.
80 "//*[@class='result-name']//*[text()='(keyword)']",
81 {"color": "rgb(120, 135, 151)"},
84 store-value: (entry_color, "rgb(0, 150, 207)") // color of the search entry
85 store-value: (hover_entry_color, "rgb(255, 255, 255)") // color of the hovered/focused search entry
86 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
87 store-value: (hover_background_color, "rgb(60, 60, 60)") // hover background color
90 "check-result-color", (
91 "keyword", // item kind
92 "rgb(57, 175, 215)", // color of item kind
93 "rgb(57, 175, 215)", // color of hovered/focused item kind
97 "check-result-color", (
98 "struct", // item kind
99 "rgb(255, 160, 165)", // color of item kind
100 "rgb(255, 160, 165)", // color of hovered/focused item kind
104 "check-result-color", (
105 "associatedtype", // item kind
106 "rgb(57, 175, 215)", // color of item kind
107 "rgb(57, 175, 215)", // color of hovered/focused item kind
111 "check-result-color", (
112 "tymethod", // item kind
113 "rgb(253, 214, 135)", // color of item kind
114 "rgb(253, 214, 135)", // color of hovered/focused item kind
118 "check-result-color", (
119 "method", // item kind
120 "rgb(253, 214, 135)", // color of item kind
121 "rgb(253, 214, 135)", // color of hovered/focused item kind
125 "check-result-color", (
126 "structfield", // item kind
127 "rgb(0, 150, 207)", // color of item kind
128 "rgb(255, 255, 255)", // color of hovered/focused item kind
132 "check-result-color", (
133 "macro", // item kind
134 "rgb(163, 122, 204)", // color of item kind
135 "rgb(163, 122, 204)", // color of hovered/focused item kind
139 "check-result-color", (
141 "rgb(253, 214, 135)", // color of item kind
142 "rgb(253, 214, 135)", // color of hovered/focused item kind
146 // Checking the `<a>` container.
147 move-cursor-to: ".search-input"
148 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
150 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
151 {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
155 // Checking color and background on hover.
156 move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
158 "//*[@class='result-name']/*[text()='test_docs::']",
159 {"color": "rgb(255, 255, 255)"},
162 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
163 {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
168 "rustdoc-theme": "dark",
169 "rustdoc-use-system-theme": "false",
173 // Waiting for the search results to appear...
176 "//*[@class='desc']//*[text()='Just a normal struct.']",
177 {"color": "rgb(221, 221, 221)"},
180 "//*[@class='result-name']/*[text()='test_docs::']",
181 {"color": "rgb(221, 221, 221)"},
184 // Checking the color for "keyword" text.
186 "//*[@class='result-name']//*[text()='(keyword)']",
187 {"color": "rgb(221, 221, 221)"},
190 store-value: (entry_color, "rgb(221, 221, 221)") // color of the search entry
191 store-value: (hover_entry_color, "rgb(221, 221, 221)") // color of the hovered/focused search entry
192 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
193 store-value: (hover_background_color, "rgb(97, 97, 97)") // hover background color
196 "check-result-color", (
197 "keyword", // item kind
198 "rgb(210, 153, 29)", // color of item kind
199 "rgb(210, 153, 29)", // color of hovered/focused item kind
203 "check-result-color", (
204 "struct", // item kind
205 "rgb(45, 191, 184)", // color of item kind
206 "rgb(45, 191, 184)", // color of hovered/focused item kind
210 "check-result-color", (
211 "associatedtype", // item kind
212 "rgb(210, 153, 29)", // color of item kind
213 "rgb(210, 153, 29)", // color of hovered/focused item kind
217 "check-result-color", (
218 "tymethod", // item kind
219 "rgb(43, 171, 99)", // color of item kind
220 "rgb(43, 171, 99)", // color of hovered/focused item kind
224 "check-result-color", (
225 "method", // item kind
226 "rgb(43, 171, 99)", // color of item kind
227 "rgb(43, 171, 99)", // color of hovered/focused item kind
231 "check-result-color", (
232 "structfield", // item kind
233 "rgb(221, 221, 221)", // color of item kind
234 "rgb(221, 221, 221)", // color of hovered/focused item kind
238 "check-result-color", (
239 "macro", // item kind
240 "rgb(9, 189, 0)", // color of item kind
241 "rgb(9, 189, 0)", // color of hovered/focused item kind
245 "check-result-color", (
247 "rgb(43, 171, 99)", // color of item kind
248 "rgb(43, 171, 99)", // color of hovered/focused item kind
252 // Checking the `<a>` container.
253 move-cursor-to: ".search-input"
254 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
256 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
257 {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
261 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
264 // Waiting for the search results to appear...
267 "//*[@class='desc']//*[text()='Just a normal struct.']",
268 {"color": "rgb(0, 0, 0)"},
271 "//*[@class='result-name']/*[text()='test_docs::']",
272 {"color": "rgb(0, 0, 0)"},
275 // Checking the color for "keyword" text.
277 "//*[@class='result-name']//*[text()='(keyword)']",
278 {"color": "rgb(0, 0, 0)"},
281 store-value: (entry_color, "rgb(0, 0, 0)") // color of the search entry
282 store-value: (hover_entry_color, "rgb(0, 0, 0)") // color of the hovered/focused search entry
283 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
284 store-value: (hover_background_color, "rgb(204, 204, 204)") // hover background color
287 "check-result-color", (
288 "keyword", // item kind
289 "rgb(56, 115, 173)", // color of item kind
290 "rgb(56, 115, 173)", // color of hovered/focused item kind
294 "check-result-color", (
295 "struct", // item kind
296 "rgb(173, 55, 138)", // color of item kind
297 "rgb(173, 55, 138)", // color of hovered/focused item kind
301 "check-result-color", (
302 "associatedtype", // item kind
303 "rgb(56, 115, 173)", // color of item kind
304 "rgb(56, 115, 173)", // color of hovered/focused item kind
308 "check-result-color", (
309 "tymethod", // item kind
310 "rgb(173, 124, 55)", // color of item kind
311 "rgb(173, 124, 55)", // color of hovered/focused item kind
315 "check-result-color", (
316 "method", // item kind
317 "rgb(173, 124, 55)", // color of item kind
318 "rgb(173, 124, 55)", // color of hovered/focused item kind
322 "check-result-color", (
323 "structfield", // item kind
324 "rgb(0, 0, 0)", // color of item kind
325 "rgb(0, 0, 0)", // color of hovered/focused item kind
329 "check-result-color", (
330 "macro", // item kind
331 "rgb(6, 128, 0)", // color of item kind
332 "rgb(6, 128, 0)", // color of hovered/focused item kind
336 "check-result-color", (
338 "rgb(173, 124, 55)", // color of item kind
339 "rgb(173, 124, 55)", // color of hovered/focused item kind
343 // Checking the `<a>` container.
344 move-cursor-to: ".search-input"
345 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
347 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
348 {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
351 // Check the alias more specifically in the dark theme.
352 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
353 // We set the theme so we're sure that the correct values will be used, whatever the computer
354 // this test is running on.
356 "rustdoc-theme": "dark",
357 "rustdoc-use-system-theme": "false",
359 // If the text isn't displayed, the browser doesn't compute color style correctly...
361 // We reload the page so the local storage settings are being used.
363 write: (".search-input", "thisisanalias")
364 // To be SURE that the search will be run.
366 // Waiting for the search results to appear...
368 // Checking that the colors for the alias element are the ones expected.
369 assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
370 assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})