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 the bottom border.
80 ".search-results > a",
81 {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
84 // Checking the color of "keyword" text.
86 "//*[@class='result-name']//*[text()='(keyword)']",
87 {"color": "rgb(120, 135, 151)"},
90 store-value: (entry_color, "rgb(0, 150, 207)") // color of the search entry
91 store-value: (hover_entry_color, "rgb(255, 255, 255)") // color of the hovered/focused search entry
92 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
93 store-value: (hover_background_color, "rgb(60, 60, 60)") // hover background color
96 "check-result-color", (
97 "keyword", // item kind
98 "rgb(57, 175, 215)", // color of item kind
99 "rgb(57, 175, 215)", // color of hovered/focused item kind
103 "check-result-color", (
104 "struct", // item kind
105 "rgb(255, 160, 165)", // color of item kind
106 "rgb(255, 160, 165)", // color of hovered/focused item kind
110 "check-result-color", (
111 "associatedtype", // item kind
112 "rgb(57, 175, 215)", // color of item kind
113 "rgb(57, 175, 215)", // color of hovered/focused item kind
117 "check-result-color", (
118 "tymethod", // item kind
119 "rgb(253, 214, 135)", // color of item kind
120 "rgb(253, 214, 135)", // color of hovered/focused item kind
124 "check-result-color", (
125 "method", // item kind
126 "rgb(253, 214, 135)", // color of item kind
127 "rgb(253, 214, 135)", // color of hovered/focused item kind
131 "check-result-color", (
132 "structfield", // item kind
133 "rgb(0, 150, 207)", // color of item kind
134 "rgb(255, 255, 255)", // color of hovered/focused item kind
138 "check-result-color", (
139 "macro", // item kind
140 "rgb(163, 122, 204)", // color of item kind
141 "rgb(163, 122, 204)", // color of hovered/focused item kind
145 "check-result-color", (
147 "rgb(253, 214, 135)", // color of item kind
148 "rgb(253, 214, 135)", // color of hovered/focused item kind
152 // Checking the `<a>` container.
153 move-cursor-to: ".search-input"
154 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
156 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
157 {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
161 // Checking color and background on hover.
162 move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
164 "//*[@class='result-name']/*[text()='test_docs::']",
165 {"color": "rgb(255, 255, 255)"},
168 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
169 {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
174 "rustdoc-theme": "dark",
175 "rustdoc-use-system-theme": "false",
179 // Waiting for the search results to appear...
182 "//*[@class='desc'][text()='Just a normal struct.']",
183 {"color": "rgb(221, 221, 221)"},
186 "//*[@class='result-name']/*[text()='test_docs::']",
187 {"color": "rgb(221, 221, 221)"},
190 // Checking the color of the bottom border.
192 ".search-results > a",
193 {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
196 // Checking the color for "keyword" text.
198 "//*[@class='result-name']//*[text()='(keyword)']",
199 {"color": "rgb(221, 221, 221)"},
202 store-value: (entry_color, "rgb(221, 221, 221)") // color of the search entry
203 store-value: (hover_entry_color, "rgb(221, 221, 221)") // color of the hovered/focused search entry
204 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
205 store-value: (hover_background_color, "rgb(97, 97, 97)") // hover background color
208 "check-result-color", (
209 "keyword", // item kind
210 "rgb(210, 153, 29)", // color of item kind
211 "rgb(210, 153, 29)", // color of hovered/focused item kind
215 "check-result-color", (
216 "struct", // item kind
217 "rgb(45, 191, 184)", // color of item kind
218 "rgb(45, 191, 184)", // color of hovered/focused item kind
222 "check-result-color", (
223 "associatedtype", // item kind
224 "rgb(210, 153, 29)", // color of item kind
225 "rgb(210, 153, 29)", // color of hovered/focused item kind
229 "check-result-color", (
230 "tymethod", // item kind
231 "rgb(43, 171, 99)", // color of item kind
232 "rgb(43, 171, 99)", // color of hovered/focused item kind
236 "check-result-color", (
237 "method", // item kind
238 "rgb(43, 171, 99)", // color of item kind
239 "rgb(43, 171, 99)", // color of hovered/focused item kind
243 "check-result-color", (
244 "structfield", // item kind
245 "rgb(221, 221, 221)", // color of item kind
246 "rgb(221, 221, 221)", // color of hovered/focused item kind
250 "check-result-color", (
251 "macro", // item kind
252 "rgb(9, 189, 0)", // color of item kind
253 "rgb(9, 189, 0)", // color of hovered/focused item kind
257 "check-result-color", (
259 "rgb(43, 171, 99)", // color of item kind
260 "rgb(43, 171, 99)", // color of hovered/focused item kind
264 // Checking the `<a>` container.
265 move-cursor-to: ".search-input"
266 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
268 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
269 {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
273 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
276 // Waiting for the search results to appear...
279 "//*[@class='desc'][text()='Just a normal struct.']",
280 {"color": "rgb(0, 0, 0)"},
283 "//*[@class='result-name']/*[text()='test_docs::']",
284 {"color": "rgb(0, 0, 0)"},
287 // Checking the color of the bottom border.
289 ".search-results > a",
290 {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
293 // Checking the color for "keyword" text.
295 "//*[@class='result-name']//*[text()='(keyword)']",
296 {"color": "rgb(0, 0, 0)"},
299 store-value: (entry_color, "rgb(0, 0, 0)") // color of the search entry
300 store-value: (hover_entry_color, "rgb(0, 0, 0)") // color of the hovered/focused search entry
301 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
302 store-value: (hover_background_color, "rgb(204, 204, 204)") // hover background color
305 "check-result-color", (
306 "keyword", // item kind
307 "rgb(56, 115, 173)", // color of item kind
308 "rgb(56, 115, 173)", // color of hovered/focused item kind
312 "check-result-color", (
313 "struct", // item kind
314 "rgb(173, 55, 138)", // color of item kind
315 "rgb(173, 55, 138)", // color of hovered/focused item kind
319 "check-result-color", (
320 "associatedtype", // item kind
321 "rgb(56, 115, 173)", // color of item kind
322 "rgb(56, 115, 173)", // color of hovered/focused item kind
326 "check-result-color", (
327 "tymethod", // item kind
328 "rgb(173, 124, 55)", // color of item kind
329 "rgb(173, 124, 55)", // color of hovered/focused item kind
333 "check-result-color", (
334 "method", // item kind
335 "rgb(173, 124, 55)", // color of item kind
336 "rgb(173, 124, 55)", // color of hovered/focused item kind
340 "check-result-color", (
341 "structfield", // item kind
342 "rgb(0, 0, 0)", // color of item kind
343 "rgb(0, 0, 0)", // color of hovered/focused item kind
347 "check-result-color", (
348 "macro", // item kind
349 "rgb(6, 128, 0)", // color of item kind
350 "rgb(6, 128, 0)", // color of hovered/focused item kind
354 "check-result-color", (
356 "rgb(173, 124, 55)", // color of item kind
357 "rgb(173, 124, 55)", // color of hovered/focused item kind
361 // Checking the `<a>` container.
362 move-cursor-to: ".search-input"
363 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
365 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
366 {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
370 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
371 // If the text isn't displayed, the browser doesn't compute color style correctly...
376 (theme, alias, grey),
378 ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
380 ("write", (".search-input", "thisisanalias")),
381 // To be SURE that the search will be run.
382 ("press-key", 'Enter'),
383 // Waiting for the search results to appear...
384 ("wait-for", "#titles"),
385 // Checking that the colors for the alias element are the ones expected.
386 ("assert-css", (".result-name > .alias", {"color": |alias|})),
387 ("assert-css", (".result-name > .alias > .grey", {"color": |grey|})),
388 // Leave the search results to prevent reloading with an already filled search input.
389 ("press-key", "Escape"),
393 call-function: ("check-alias", {
395 "alias": "rgb(197, 197, 197)",
396 "grey": "rgb(153, 153, 153)",
398 call-function: ("check-alias", {
400 "alias": "rgb(255, 255, 255)",
401 "grey": "rgb(204, 204, 204)",
403 call-function: ("check-alias", {
405 "alias": "rgb(0, 0, 0)",
406 "grey": "rgb(153, 153, 153)",