@@ -69,6 +69,32 @@ define-function: (
69
69
},
70
70
)
71
71
72
+ define-function: (
73
+ "check-container-color",
74
+ [link_color, path_color, hover_background],
75
+ block {
76
+ // Checking the `<a>` container.
77
+ move-cursor-to: ".search-input"
78
+ focus: ".search-input" // To ensure the `<a>` container isn't focused or hovered.
79
+ assert-css: (
80
+ "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
81
+ {"color": |link_color|, "background-color": "transparent"},
82
+ ALL,
83
+ )
84
+
85
+ // Checking color and background on hover.
86
+ move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
87
+ assert-css: (
88
+ "//*[@class='result-name']//*[text()='test_docs::']",
89
+ {"color": |path_color|},
90
+ )
91
+ assert-css: (
92
+ "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
93
+ {"color": |path_color|, "background-color": |hover_background|},
94
+ )
95
+ }
96
+ )
97
+
72
98
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo"
73
99
74
100
// This is needed so that the text color is computed.
@@ -146,24 +172,12 @@ call-function: (
146
172
},
147
173
)
148
174
149
- // Checking the `<a>` container.
150
- move-cursor-to: ".search-input"
151
- focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
152
- assert-css: (
153
- "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
154
- {"color": "#0096cf", "background-color": "transparent"},
155
- ALL,
156
- )
157
-
158
- // Checking color and background on hover.
159
- move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
160
- assert-css: (
161
- "//*[@class='result-name']//*[text()='test_docs::']",
162
- {"color": "#fff"},
163
- )
164
- assert-css: (
165
- "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
166
- {"color": "#fff", "background-color": "#3c3c3c"},
175
+ call-function: (
176
+ "check-container-color", {
177
+ "link_color": "#0096cf",
178
+ "path_color": "#fff",
179
+ "hover_background": "#3c3c3c",
180
+ },
167
181
)
168
182
169
183
// Dark theme
@@ -238,12 +252,12 @@ call-function: (
238
252
},
239
253
)
240
254
241
- // Checking the `<a>` container.
242
- move-cursor-to: ".search-input"
243
- focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
244
- assert-css: (
245
- "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a ",
246
- {"color": "#ddd", "background-color": "transparent" },
255
+ call-function: (
256
+ "check-container-color", {
257
+ "link_color": "#ddd",
258
+ "path_color": "#ddd",
259
+ "hover_background": "#616161 ",
260
+ },
247
261
)
248
262
249
263
// Light theme
@@ -318,12 +332,12 @@ call-function: (
318
332
},
319
333
)
320
334
321
- // Checking the `<a>` container.
322
- move-cursor-to: ".search-input"
323
- focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
324
- assert-css: (
325
- "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a ",
326
- {"color": "#000", "background-color": "transparent" },
335
+ call-function: (
336
+ "check-container-color", {
337
+ "link_color": "#000",
338
+ "path_color": "#000",
339
+ "hover_background": "#ccc ",
340
+ },
327
341
)
328
342
329
343
// Check the alias.
0 commit comments