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 "#titles > button > div.count",
71 {"color": "rgb(136, 136, 136)"},
75 "//*[@class='desc'][text()='Just a normal struct.']",
76 {"color": "rgb(197, 197, 197)"},
79 "//*[@class='result-name']/*[text()='test_docs::']",
80 {"color": "rgb(0, 150, 207)"},
83 // Checking the color of the bottom border.
85 ".search-results > a",
86 {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
89 // Checking the color of "keyword" text.
91 "//*[@class='result-name']//*[text()='(keyword)']",
92 {"color": "rgb(120, 135, 151)"},
95 store-value: (entry_color, "rgb(0, 150, 207)") // color of the search entry
96 store-value: (hover_entry_color, "rgb(255, 255, 255)") // color of the hovered/focused search entry
97 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
98 store-value: (hover_background_color, "rgb(60, 60, 60)") // hover background color
101 "check-result-color", (
102 "keyword", // item kind
103 "rgb(57, 175, 215)", // color of item kind
104 "rgb(57, 175, 215)", // color of hovered/focused item kind
108 "check-result-color", (
109 "struct", // item kind
110 "rgb(255, 160, 165)", // color of item kind
111 "rgb(255, 160, 165)", // color of hovered/focused item kind
115 "check-result-color", (
116 "associatedtype", // item kind
117 "rgb(57, 175, 215)", // color of item kind
118 "rgb(57, 175, 215)", // color of hovered/focused item kind
122 "check-result-color", (
123 "tymethod", // item kind
124 "rgb(253, 214, 135)", // color of item kind
125 "rgb(253, 214, 135)", // color of hovered/focused item kind
129 "check-result-color", (
130 "method", // item kind
131 "rgb(253, 214, 135)", // color of item kind
132 "rgb(253, 214, 135)", // color of hovered/focused item kind
136 "check-result-color", (
137 "structfield", // item kind
138 "rgb(0, 150, 207)", // color of item kind
139 "rgb(255, 255, 255)", // color of hovered/focused item kind
143 "check-result-color", (
144 "macro", // item kind
145 "rgb(163, 122, 204)", // color of item kind
146 "rgb(163, 122, 204)", // color of hovered/focused item kind
150 "check-result-color", (
152 "rgb(253, 214, 135)", // color of item kind
153 "rgb(253, 214, 135)", // color of hovered/focused item kind
157 // Checking the `<a>` container.
158 move-cursor-to: ".search-input"
159 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
161 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
162 {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
166 // Checking color and background on hover.
167 move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
169 "//*[@class='result-name']/*[text()='test_docs::']",
170 {"color": "rgb(255, 255, 255)"},
173 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
174 {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
179 "rustdoc-theme": "dark",
180 "rustdoc-use-system-theme": "false",
184 // Waiting for the search results to appear...
187 "#titles > button > div.count",
188 {"color": "rgb(136, 136, 136)"},
192 "//*[@class='desc'][text()='Just a normal struct.']",
193 {"color": "rgb(221, 221, 221)"},
196 "//*[@class='result-name']/*[text()='test_docs::']",
197 {"color": "rgb(221, 221, 221)"},
200 // Checking the color of the bottom border.
202 ".search-results > a",
203 {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
206 // Checking the color for "keyword" text.
208 "//*[@class='result-name']//*[text()='(keyword)']",
209 {"color": "rgb(221, 221, 221)"},
212 store-value: (entry_color, "rgb(221, 221, 221)") // color of the search entry
213 store-value: (hover_entry_color, "rgb(221, 221, 221)") // color of the hovered/focused search entry
214 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
215 store-value: (hover_background_color, "rgb(97, 97, 97)") // hover background color
218 "check-result-color", (
219 "keyword", // item kind
220 "rgb(210, 153, 29)", // color of item kind
221 "rgb(210, 153, 29)", // color of hovered/focused item kind
225 "check-result-color", (
226 "struct", // item kind
227 "rgb(45, 191, 184)", // color of item kind
228 "rgb(45, 191, 184)", // color of hovered/focused item kind
232 "check-result-color", (
233 "associatedtype", // item kind
234 "rgb(210, 153, 29)", // color of item kind
235 "rgb(210, 153, 29)", // color of hovered/focused item kind
239 "check-result-color", (
240 "tymethod", // item kind
241 "rgb(43, 171, 99)", // color of item kind
242 "rgb(43, 171, 99)", // color of hovered/focused item kind
246 "check-result-color", (
247 "method", // item kind
248 "rgb(43, 171, 99)", // color of item kind
249 "rgb(43, 171, 99)", // color of hovered/focused item kind
253 "check-result-color", (
254 "structfield", // item kind
255 "rgb(221, 221, 221)", // color of item kind
256 "rgb(221, 221, 221)", // color of hovered/focused item kind
260 "check-result-color", (
261 "macro", // item kind
262 "rgb(9, 189, 0)", // color of item kind
263 "rgb(9, 189, 0)", // color of hovered/focused item kind
267 "check-result-color", (
269 "rgb(43, 171, 99)", // color of item kind
270 "rgb(43, 171, 99)", // color of hovered/focused item kind
274 // Checking the `<a>` container.
275 move-cursor-to: ".search-input"
276 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
278 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
279 {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
283 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
286 // Waiting for the search results to appear...
289 "#titles > button > div.count",
290 {"color": "rgb(136, 136, 136)"},
294 "//*[@class='desc'][text()='Just a normal struct.']",
295 {"color": "rgb(0, 0, 0)"},
298 "//*[@class='result-name']/*[text()='test_docs::']",
299 {"color": "rgb(0, 0, 0)"},
302 // Checking the color of the bottom border.
304 ".search-results > a",
305 {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
308 // Checking the color for "keyword" text.
310 "//*[@class='result-name']//*[text()='(keyword)']",
311 {"color": "rgb(0, 0, 0)"},
314 store-value: (entry_color, "rgb(0, 0, 0)") // color of the search entry
315 store-value: (hover_entry_color, "rgb(0, 0, 0)") // color of the hovered/focused search entry
316 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
317 store-value: (hover_background_color, "rgb(204, 204, 204)") // hover background color
320 "check-result-color", (
321 "keyword", // item kind
322 "rgb(56, 115, 173)", // color of item kind
323 "rgb(56, 115, 173)", // color of hovered/focused item kind
327 "check-result-color", (
328 "struct", // item kind
329 "rgb(173, 55, 138)", // color of item kind
330 "rgb(173, 55, 138)", // color of hovered/focused item kind
334 "check-result-color", (
335 "associatedtype", // item kind
336 "rgb(56, 115, 173)", // color of item kind
337 "rgb(56, 115, 173)", // color of hovered/focused item kind
341 "check-result-color", (
342 "tymethod", // item kind
343 "rgb(173, 124, 55)", // color of item kind
344 "rgb(173, 124, 55)", // color of hovered/focused item kind
348 "check-result-color", (
349 "method", // item kind
350 "rgb(173, 124, 55)", // color of item kind
351 "rgb(173, 124, 55)", // color of hovered/focused item kind
355 "check-result-color", (
356 "structfield", // item kind
357 "rgb(0, 0, 0)", // color of item kind
358 "rgb(0, 0, 0)", // color of hovered/focused item kind
362 "check-result-color", (
363 "macro", // item kind
364 "rgb(6, 128, 0)", // color of item kind
365 "rgb(6, 128, 0)", // color of hovered/focused item kind
369 "check-result-color", (
371 "rgb(173, 124, 55)", // color of item kind
372 "rgb(173, 124, 55)", // color of hovered/focused item kind
376 // Checking the `<a>` container.
377 move-cursor-to: ".search-input"
378 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
380 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
381 {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
385 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
386 // If the text isn't displayed, the browser doesn't compute color style correctly...
391 (theme, alias, grey),
393 ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
395 ("write", (".search-input", "thisisanalias")),
396 // To be SURE that the search will be run.
397 ("press-key", 'Enter'),
398 // Waiting for the search results to appear...
399 ("wait-for", "#titles"),
400 // Checking that the colors for the alias element are the ones expected.
401 ("assert-css", (".result-name > .alias", {"color": |alias|})),
402 ("assert-css", (".result-name > .alias > .grey", {"color": |grey|})),
403 // Leave the search results to prevent reloading with an already filled search input.
404 ("press-key", "Escape"),
408 call-function: ("check-alias", {
410 "alias": "rgb(197, 197, 197)",
411 "grey": "rgb(153, 153, 153)",
413 call-function: ("check-alias", {
415 "alias": "rgb(255, 255, 255)",
416 "grey": "rgb(204, 204, 204)",
418 call-function: ("check-alias", {
420 "alias": "rgb(0, 0, 0)",
421 "grey": "rgb(153, 153, 153)",