|
1 | 1 | // The goal of this test is to ensure the color of the text is the one expected.
|
2 | 2 |
|
3 | 3 | include: "utils.goml"
|
| 4 | + |
| 5 | +define-function: ( |
| 6 | + "check-search-color", |
| 7 | + [theme, count_color, desc_color, path_color, bottom_border_color], |
| 8 | + block { |
| 9 | + call-function: ("switch-theme", {"theme": |theme|}) |
| 10 | + |
| 11 | + // Waiting for the search results to appear... |
| 12 | + wait-for: "#search-tabs" |
| 13 | + assert-css: ( |
| 14 | + "#search-tabs > button > .count", |
| 15 | + {"color": |count_color|}, |
| 16 | + ALL, |
| 17 | + ) |
| 18 | + assert-css: ( |
| 19 | + "//*[@class='desc'][text()='Just a normal struct.']", |
| 20 | + {"color": |desc_color|}, |
| 21 | + ) |
| 22 | + assert-css: ( |
| 23 | + "//*[@class='result-name']//*[text()='test_docs::']", |
| 24 | + {"color": |path_color|}, |
| 25 | + ) |
| 26 | + |
| 27 | + // Checking the color of the bottom border. |
| 28 | + assert-css: ( |
| 29 | + ".search-results > a", |
| 30 | + {"border-bottom-color": |bottom_border_color|} |
| 31 | + ) |
| 32 | + } |
| 33 | +) |
| 34 | + |
4 | 35 | define-function: (
|
5 | 36 | "check-result-color",
|
6 | 37 | [result_kind, color, hover_color],
|
@@ -44,29 +75,13 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo"
|
44 | 75 | show-text: true
|
45 | 76 |
|
46 | 77 | // Ayu theme
|
47 |
| -call-function: ("switch-theme", {"theme": "ayu"}) |
48 |
| - |
49 |
| -// Waiting for the search results to appear... |
50 |
| -wait-for: "#search-tabs" |
51 |
| -assert-css: ( |
52 |
| - "#search-tabs > button > .count", |
53 |
| - {"color": "#888"}, |
54 |
| - ALL, |
55 |
| -) |
56 |
| -assert-css: ( |
57 |
| - "//*[@class='desc'][text()='Just a normal struct.']", |
58 |
| - {"color": "#c5c5c5"}, |
59 |
| -) |
60 |
| -assert-css: ( |
61 |
| - "//*[@class='result-name']//*[text()='test_docs::']", |
62 |
| - {"color": "#0096cf"}, |
63 |
| -) |
64 |
| - |
65 |
| -// Checking the color of the bottom border. |
66 |
| -assert-css: ( |
67 |
| - ".search-results > a", |
68 |
| - {"border-bottom-color": "#aaa3"} |
69 |
| -) |
| 78 | +call-function: ("check-search-color", { |
| 79 | + "theme": "ayu", |
| 80 | + "count_color": "#888", |
| 81 | + "desc_color": "#c5c5c5", |
| 82 | + "path_color": "#0096cf", |
| 83 | + "bottom_border_color": "#aaa3", |
| 84 | +}) |
70 | 85 |
|
71 | 86 | store-value: (entry_color, "#0096cf") // color of the search entry
|
72 | 87 | store-value: (hover_entry_color, "#fff") // color of the hovered/focused search entry
|
@@ -152,29 +167,13 @@ assert-css: (
|
152 | 167 | )
|
153 | 168 |
|
154 | 169 | // Dark theme
|
155 |
| -call-function: ("switch-theme", {"theme": "dark"}) |
156 |
| - |
157 |
| -// Waiting for the search results to appear... |
158 |
| -wait-for: "#search-tabs" |
159 |
| -assert-css: ( |
160 |
| - "#search-tabs > button > .count", |
161 |
| - {"color": "#888"}, |
162 |
| - ALL, |
163 |
| -) |
164 |
| -assert-css: ( |
165 |
| - "//*[@class='desc'][text()='Just a normal struct.']", |
166 |
| - {"color": "#ddd"}, |
167 |
| -) |
168 |
| -assert-css: ( |
169 |
| - "//*[@class='result-name']//*[text()='test_docs::']", |
170 |
| - {"color": "#ddd"}, |
171 |
| -) |
172 |
| - |
173 |
| -// Checking the color of the bottom border. |
174 |
| -assert-css: ( |
175 |
| - ".search-results > a", |
176 |
| - {"border-bottom-color": "#aaa3"} |
177 |
| -) |
| 170 | +call-function: ("check-search-color", { |
| 171 | + "theme": "dark", |
| 172 | + "count_color": "#888", |
| 173 | + "desc_color": "#ddd", |
| 174 | + "path_color": "#ddd", |
| 175 | + "bottom_border_color": "#aaa3", |
| 176 | +}) |
178 | 177 |
|
179 | 178 | store-value: (entry_color, "#ddd") // color of the search entry
|
180 | 179 | store-value: (hover_entry_color, "#ddd") // color of the hovered/focused search entry
|
@@ -248,29 +247,13 @@ assert-css: (
|
248 | 247 | )
|
249 | 248 |
|
250 | 249 | // Light theme
|
251 |
| -call-function: ("switch-theme", {"theme": "light"}) |
252 |
| - |
253 |
| -// Waiting for the search results to appear... |
254 |
| -wait-for: "#search-tabs" |
255 |
| -assert-css: ( |
256 |
| - "#search-tabs > button > .count", |
257 |
| - {"color": "#888"}, |
258 |
| - ALL, |
259 |
| -) |
260 |
| -assert-css: ( |
261 |
| - "//*[@class='desc'][text()='Just a normal struct.']", |
262 |
| - {"color": "#000"}, |
263 |
| -) |
264 |
| -assert-css: ( |
265 |
| - "//*[@class='result-name']//*[text()='test_docs::']", |
266 |
| - {"color": "#000"}, |
267 |
| -) |
268 |
| - |
269 |
| -// Checking the color of the bottom border. |
270 |
| -assert-css: ( |
271 |
| - ".search-results > a", |
272 |
| - {"border-bottom-color": "#aaa3"} |
273 |
| -) |
| 250 | +call-function: ("check-search-color", { |
| 251 | + "theme": "light", |
| 252 | + "count_color": "#888", |
| 253 | + "desc_color": "#000", |
| 254 | + "path_color": "#000", |
| 255 | + "bottom_border_color": "#aaa3", |
| 256 | +}) |
274 | 257 |
|
275 | 258 | store-value: (entry_color, "#000") // color of the search entry
|
276 | 259 | store-value: (hover_entry_color, "#000") // color of the hovered/focused search entry
|
|
0 commit comments