1 // The goal of this test is to ensure the color of the text is the one expected.
5 (result_kind, color, hover_color),
7 assert-css: (".result-" + |result_kind| + " ." + |result_kind|, {"color": |color|}, ALL)
9 ".result-" + |result_kind|,
10 {"color": |entry_color|, "background-color": |background_color|},
12 move-cursor-to: ".result-" + |result_kind|
14 ".result-" + |result_kind| + ":hover",
15 {"color": |hover_entry_color|, "background-color": |hover_background_color|},
18 ".result-" + |result_kind| + ":hover ." + |result_kind|,
19 {"color": |hover_color|},
21 move-cursor-to: ".search-input"
22 focus: ".result-" + |result_kind|
24 ".result-" + |result_kind| + ":focus",
25 {"color": |hover_entry_color|, "background-color": |hover_background_color|},
28 ".result-" + |result_kind| + ":focus ." + |result_kind|,
29 {"color": |hover_color|},
34 goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo"
36 // This is needed so that the text color is computed.
41 "rustdoc-theme": "ayu",
42 "rustdoc-use-system-theme": "false",
46 // Waiting for the search results to appear...
47 wait-for: "#search-tabs"
49 "#search-tabs > button > .count",
50 {"color": "rgb(136, 136, 136)"},
54 "//*[@class='desc'][text()='Just a normal struct.']",
55 {"color": "rgb(197, 197, 197)"},
58 "//*[@class='result-name']/*[text()='test_docs::']",
59 {"color": "rgb(0, 150, 207)"},
62 // Checking the color of the bottom border.
64 ".search-results > a",
65 {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
68 // Checking the color of "keyword" text.
70 "//*[@class='result-name']//*[text()='(keyword)']",
71 {"color": "rgb(120, 135, 151)"},
74 store-value: (entry_color, "rgb(0, 150, 207)") // color of the search entry
75 store-value: (hover_entry_color, "rgb(255, 255, 255)") // color of the hovered/focused search entry
76 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
77 store-value: (hover_background_color, "rgb(60, 60, 60)") // hover background color
80 "check-result-color", (
81 "keyword", // item kind
82 "rgb(57, 175, 215)", // color of item kind
83 "rgb(57, 175, 215)", // color of hovered/focused item kind
87 "check-result-color", (
88 "struct", // item kind
89 "rgb(255, 160, 165)", // color of item kind
90 "rgb(255, 160, 165)", // color of hovered/focused item kind
94 "check-result-color", (
95 "associatedtype", // item kind
96 "rgb(57, 175, 215)", // color of item kind
97 "rgb(57, 175, 215)", // color of hovered/focused item kind
101 "check-result-color", (
102 "tymethod", // item kind
103 "rgb(253, 214, 135)", // color of item kind
104 "rgb(253, 214, 135)", // color of hovered/focused item kind
108 "check-result-color", (
109 "method", // item kind
110 "rgb(253, 214, 135)", // color of item kind
111 "rgb(253, 214, 135)", // color of hovered/focused item kind
115 "check-result-color", (
116 "structfield", // item kind
117 "rgb(0, 150, 207)", // color of item kind
118 "rgb(255, 255, 255)", // color of hovered/focused item kind
122 "check-result-color", (
123 "macro", // item kind
124 "rgb(163, 122, 204)", // color of item kind
125 "rgb(163, 122, 204)", // color of hovered/focused item kind
129 "check-result-color", (
131 "rgb(253, 214, 135)", // color of item kind
132 "rgb(253, 214, 135)", // color of hovered/focused item kind
136 // Checking the `<a>` container.
137 move-cursor-to: ".search-input"
138 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
140 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
141 {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
145 // Checking color and background on hover.
146 move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
148 "//*[@class='result-name']/*[text()='test_docs::']",
149 {"color": "rgb(255, 255, 255)"},
152 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
153 {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
158 "rustdoc-theme": "dark",
159 "rustdoc-use-system-theme": "false",
163 // Waiting for the search results to appear...
164 wait-for: "#search-tabs"
166 "#search-tabs > button > .count",
167 {"color": "rgb(136, 136, 136)"},
171 "//*[@class='desc'][text()='Just a normal struct.']",
172 {"color": "rgb(221, 221, 221)"},
175 "//*[@class='result-name']/*[text()='test_docs::']",
176 {"color": "rgb(221, 221, 221)"},
179 // Checking the color of the bottom border.
181 ".search-results > a",
182 {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
185 // Checking the color for "keyword" text.
187 "//*[@class='result-name']//*[text()='(keyword)']",
188 {"color": "rgb(221, 221, 221)"},
191 store-value: (entry_color, "rgb(221, 221, 221)") // color of the search entry
192 store-value: (hover_entry_color, "rgb(221, 221, 221)") // color of the hovered/focused search entry
193 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
194 store-value: (hover_background_color, "rgb(97, 97, 97)") // hover background color
197 "check-result-color", (
198 "keyword", // item kind
199 "rgb(210, 153, 29)", // color of item kind
200 "rgb(210, 153, 29)", // color of hovered/focused item kind
204 "check-result-color", (
205 "struct", // item kind
206 "rgb(45, 191, 184)", // color of item kind
207 "rgb(45, 191, 184)", // color of hovered/focused item kind
211 "check-result-color", (
212 "associatedtype", // item kind
213 "rgb(210, 153, 29)", // color of item kind
214 "rgb(210, 153, 29)", // color of hovered/focused item kind
218 "check-result-color", (
219 "tymethod", // item kind
220 "rgb(43, 171, 99)", // color of item kind
221 "rgb(43, 171, 99)", // color of hovered/focused item kind
225 "check-result-color", (
226 "method", // item kind
227 "rgb(43, 171, 99)", // color of item kind
228 "rgb(43, 171, 99)", // color of hovered/focused item kind
232 "check-result-color", (
233 "structfield", // item kind
234 "rgb(221, 221, 221)", // color of item kind
235 "rgb(221, 221, 221)", // color of hovered/focused item kind
239 "check-result-color", (
240 "macro", // item kind
241 "rgb(9, 189, 0)", // color of item kind
242 "rgb(9, 189, 0)", // color of hovered/focused item kind
246 "check-result-color", (
248 "rgb(43, 171, 99)", // color of item kind
249 "rgb(43, 171, 99)", // color of hovered/focused item kind
253 // Checking the `<a>` container.
254 move-cursor-to: ".search-input"
255 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
257 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
258 {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
262 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
265 // Waiting for the search results to appear...
266 wait-for: "#search-tabs"
268 "#search-tabs > button > .count",
269 {"color": "rgb(136, 136, 136)"},
273 "//*[@class='desc'][text()='Just a normal struct.']",
274 {"color": "rgb(0, 0, 0)"},
277 "//*[@class='result-name']/*[text()='test_docs::']",
278 {"color": "rgb(0, 0, 0)"},
281 // Checking the color of the bottom border.
283 ".search-results > a",
284 {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
287 // Checking the color for "keyword" text.
289 "//*[@class='result-name']//*[text()='(keyword)']",
290 {"color": "rgb(0, 0, 0)"},
293 store-value: (entry_color, "rgb(0, 0, 0)") // color of the search entry
294 store-value: (hover_entry_color, "rgb(0, 0, 0)") // color of the hovered/focused search entry
295 store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
296 store-value: (hover_background_color, "rgb(204, 204, 204)") // hover background color
299 "check-result-color", (
300 "keyword", // item kind
301 "rgb(56, 115, 173)", // color of item kind
302 "rgb(56, 115, 173)", // color of hovered/focused item kind
306 "check-result-color", (
307 "struct", // item kind
308 "rgb(173, 55, 138)", // color of item kind
309 "rgb(173, 55, 138)", // color of hovered/focused item kind
313 "check-result-color", (
314 "associatedtype", // item kind
315 "rgb(56, 115, 173)", // color of item kind
316 "rgb(56, 115, 173)", // color of hovered/focused item kind
320 "check-result-color", (
321 "tymethod", // item kind
322 "rgb(173, 124, 55)", // color of item kind
323 "rgb(173, 124, 55)", // color of hovered/focused item kind
327 "check-result-color", (
328 "method", // item kind
329 "rgb(173, 124, 55)", // color of item kind
330 "rgb(173, 124, 55)", // color of hovered/focused item kind
334 "check-result-color", (
335 "structfield", // item kind
336 "rgb(0, 0, 0)", // color of item kind
337 "rgb(0, 0, 0)", // color of hovered/focused item kind
341 "check-result-color", (
342 "macro", // item kind
343 "rgb(6, 128, 0)", // color of item kind
344 "rgb(6, 128, 0)", // color of hovered/focused item kind
348 "check-result-color", (
350 "rgb(173, 124, 55)", // color of item kind
351 "rgb(173, 124, 55)", // color of hovered/focused item kind
355 // Checking the `<a>` container.
356 move-cursor-to: ".search-input"
357 focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
359 "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
360 {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
364 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
365 // If the text isn't displayed, the browser doesn't compute color style correctly...
370 (theme, alias, grey),
372 local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
374 write: (".search-input", "thisisanalias")
375 // To be SURE that the search will be run.
377 // Waiting for the search results to appear...
378 wait-for: "#search-tabs"
379 // Checking that the colors for the alias element are the ones expected.
380 assert-css: (".result-name > .alias", {"color": |alias|})
381 assert-css: (".result-name > .alias > .grey", {"color": |grey|})
382 // Leave the search results to prevent reloading with an already filled search input.
387 call-function: ("check-alias", {
389 "alias": "rgb(197, 197, 197)",
390 "grey": "rgb(153, 153, 153)",
392 call-function: ("check-alias", {
394 "alias": "rgb(255, 255, 255)",
395 "grey": "rgb(204, 204, 204)",
397 call-function: ("check-alias", {
399 "alias": "rgb(0, 0, 0)",
400 "grey": "rgb(153, 153, 153)",