summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc-gui/search-result-color.goml
blob: c4b5fdf53dd6bd4863c497a6d590b56cfca2f6b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
// The goal of this test is to ensure the color of the text is the one expected.
goto: file://|DOC_PATH|/test_docs/index.html?search=coo

// This is needed so that the text color is computed.
show-text: true

// Ayu theme
local-storage: {
    "rustdoc-theme": "ayu",
    "rustdoc-use-system-theme": "false",
}
reload:

// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: (
    "//*[@class='desc']//*[text()='Just a normal struct.']",
    {"color": "rgb(197, 197, 197)"},
)
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']",
    {"color": "rgb(0, 150, 207)"},
)

// Checking the color of "keyword" text.
assert-css: (
    "//*[@class='result-name']//*[text()='(keyword)']",
    {"color": "rgb(120, 135, 151)"},
)

// Checking the color of "keyword".
assert-css: (
    ".result-name .keyword",
    {"color": "rgb(57, 175, 215)"},
    ALL,
)
// Check the color of "struct".
assert-css: (
    ".result-name .struct",
    {"color": "rgb(255, 160, 165)"},
    ALL,
)
// Check the color of "associated type".
assert-css: (
    ".result-name .associatedtype",
    {"color": "rgb(57, 175, 215)"},
    ALL,
)
// Check the color of "type method".
assert-css: (
    ".result-name .tymethod",
    {"color": "rgb(253, 214, 135)"},
    ALL,
)
// Check the color of "method".
assert-css: (
    ".result-name .method",
    {"color": "rgb(253, 214, 135)"},
    ALL,
)
// Check the color of "struct field".
assert-css: (
    ".result-name .structfield",
    {"color": "rgb(0, 150, 207)"},
    ALL,
)
// Check the color of "macro".
assert-css: (
    ".result-name .macro",
    {"color": "rgb(163, 122, 204)"},
    ALL,
)
// Check the color of "fn".
assert-css: (
    ".result-name .fn",
    {"color": "rgb(253, 214, 135)"},
    ALL,
)

// Checking the `<a>` container.
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
    {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
    ALL,
)

// Checking color and background on hover.
move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']",
    {"color": "rgb(255, 255, 255)"},
)
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
    {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
)

// Dark theme
local-storage: {
    "rustdoc-theme": "dark",
    "rustdoc-use-system-theme": "false",
}
reload:

// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: (
    "//*[@class='desc']//*[text()='Just a normal struct.']",
    {"color": "rgb(221, 221, 221)"},
)
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']",
    {"color": "rgb(221, 221, 221)"},
)

// Checking the color for "keyword".
assert-css: (
    "//*[@class='result-name']//*[text()='(keyword)']",
    {"color": "rgb(221, 221, 221)"},
)

// Checking the color of "keyword".
assert-css: (
    ".result-name .keyword",
    {"color": "rgb(210, 153, 29)"},
    ALL,
)
// Check the color of "struct".
assert-css: (
    ".result-name .struct",
    {"color": "rgb(45, 191, 184)"},
    ALL,
)
// Check the color of "associated type".
assert-css: (
    ".result-name .associatedtype",
    {"color": "rgb(210, 153, 29)"},
    ALL,
)
// Check the color of "type method".
assert-css: (
    ".result-name .tymethod",
    {"color": "rgb(43, 171, 99)"},
    ALL,
)
// Check the color of "method".
assert-css: (
    ".result-name .method",
    {"color": "rgb(43, 171, 99)"},
    ALL,
)
// Check the color of "struct field".
assert-css: (
    ".result-name .structfield",
    {"color": "rgb(221, 221, 221)"},
    ALL,
)
// Check the color of "macro".
assert-css: (
    ".result-name .macro",
    {"color": "rgb(9, 189, 0)"},
    ALL,
)
// Check the color of "fn".
assert-css: (
    ".result-name .fn",
    {"color": "rgb(43, 171, 99)"},
    ALL,
)

// Checking the `<a>` container.
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
    {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
)

// Checking color and background on hover.
move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']",
    {"color": "rgb(221, 221, 221)"},
)
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
    {"color": "rgb(221, 221, 221)", "background-color": "rgb(119, 119, 119)"},
)

// Light theme
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:

// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: (
    "//*[@class='desc']//*[text()='Just a normal struct.']",
    {"color": "rgb(0, 0, 0)"},
)
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']",
    {"color": "rgb(0, 0, 0)"},
)

// Checking the color for "keyword".
assert-css: (
    "//*[@class='result-name']//*[text()='(keyword)']",
    {"color": "rgb(0, 0, 0)"},
)

// Checking the color of "keyword".
assert-css: (
    ".result-name .keyword",
    {"color": "rgb(56, 115, 173)"},
    ALL,
)
// Check the color of "struct".
assert-css: (
    ".result-name .struct",
    {"color": "rgb(173, 55, 138)"},
    ALL,
)
// Check the color of "associated type".
assert-css: (
    ".result-name .associatedtype",
    {"color": "rgb(56, 115, 173)"},
    ALL,
)
// Check the color of "type method".
assert-css: (
    ".result-name .tymethod",
    {"color": "rgb(173, 124, 55)"},
    ALL,
)
// Check the color of "method".
assert-css: (
    ".result-name .method",
    {"color": "rgb(173, 124, 55)"},
    ALL,
)
// Check the color of "struct field".
assert-css: (
    ".result-name .structfield",
    {"color": "rgb(0, 0, 0)"},
    ALL,
)
// Check the color of "macro".
assert-css: (
    ".result-name .macro",
    {"color": "rgb(6, 128, 0)"},
    ALL,
)
// Check the color of "fn".
assert-css: (
    ".result-name .fn",
    {"color": "rgb(173, 124, 55)"},
    ALL,
)

// Checking the `<a>` container.
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
    {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
)

// Checking color and background on hover.
move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']",
    {"color": "rgb(0, 0, 0)"},
)
assert-css: (
    "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
    {"color": "rgb(0, 0, 0)", "background-color": "rgb(221, 221, 221)"},
)

// Check the alias more specifically in the dark theme.
goto: file://|DOC_PATH|/test_docs/index.html
// We set the theme so we're sure that the correct values will be used, whatever the computer
// this test is running on.
local-storage: {
    "rustdoc-theme": "dark",
    "rustdoc-use-system-theme": "false",
}
// If the text isn't displayed, the browser doesn't compute color style correctly...
show-text: true
// We reload the page so the local storage settings are being used.
reload:
write: (".search-input", "thisisanalias")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
wait-for: "#titles"
// Checking that the colors for the alias element are the ones expected.
assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})