]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/search-result-color.goml
Rollup merge of #99460 - JanBeh:PR_asref_asmut_docs, r=joshtriplett
[rust.git] / src / test / rustdoc-gui / search-result-color.goml
1 // The goal of this test is to ensure the color of the text is the one expected.
2 goto: file://|DOC_PATH|/test_docs/index.html?search=coo
3
4 // This is needed so that the text color is computed.
5 show-text: true
6
7 // Ayu theme
8 local-storage: {
9     "rustdoc-theme": "ayu",
10     "rustdoc-use-system-theme": "false",
11 }
12 reload:
13
14 // Waiting for the search results to appear...
15 wait-for: "#titles"
16 assert-css: (
17     "//*[@class='desc']//*[text()='Just a normal struct.']",
18     {"color": "rgb(197, 197, 197)"},
19 )
20 assert-css: (
21     "//*[@class='result-name']/*[text()='test_docs::']",
22     {"color": "rgb(0, 150, 207)"},
23 )
24
25 // Checking the color of "keyword" text.
26 assert-css: (
27     "//*[@class='result-name']//*[text()='(keyword)']",
28     {"color": "rgb(120, 135, 151)"},
29 )
30
31 // Checking the color of "keyword".
32 assert-css: (
33     ".result-name .keyword",
34     {"color": "rgb(57, 175, 215)"},
35     ALL,
36 )
37 // Check the color of "struct".
38 assert-css: (
39     ".result-name .struct",
40     {"color": "rgb(255, 160, 165)"},
41     ALL,
42 )
43 // Check the color of "associated type".
44 assert-css: (
45     ".result-name .associatedtype",
46     {"color": "rgb(57, 175, 215)"},
47     ALL,
48 )
49 // Check the color of "type method".
50 assert-css: (
51     ".result-name .tymethod",
52     {"color": "rgb(253, 214, 135)"},
53     ALL,
54 )
55 // Check the color of "method".
56 assert-css: (
57     ".result-name .method",
58     {"color": "rgb(253, 214, 135)"},
59     ALL,
60 )
61 // Check the color of "struct field".
62 assert-css: (
63     ".result-name .structfield",
64     {"color": "rgb(0, 150, 207)"},
65     ALL,
66 )
67 // Check the color of "macro".
68 assert-css: (
69     ".result-name .macro",
70     {"color": "rgb(163, 122, 204)"},
71     ALL,
72 )
73 // Check the color of "fn".
74 assert-css: (
75     ".result-name .fn",
76     {"color": "rgb(253, 214, 135)"},
77     ALL,
78 )
79
80 // Checking the `<a>` container.
81 assert-css: (
82     "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
83     {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
84     ALL,
85 )
86
87 // Checking color and background on hover.
88 move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
89 assert-css: (
90     "//*[@class='result-name']/*[text()='test_docs::']",
91     {"color": "rgb(255, 255, 255)"},
92 )
93 assert-css: (
94     "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
95     {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
96 )
97
98 // Dark theme
99 local-storage: {
100     "rustdoc-theme": "dark",
101     "rustdoc-use-system-theme": "false",
102 }
103 reload:
104
105 // Waiting for the search results to appear...
106 wait-for: "#titles"
107 assert-css: (
108     "//*[@class='desc']//*[text()='Just a normal struct.']",
109     {"color": "rgb(221, 221, 221)"},
110 )
111 assert-css: (
112     "//*[@class='result-name']/*[text()='test_docs::']",
113     {"color": "rgb(221, 221, 221)"},
114 )
115
116 // Checking the color for "keyword".
117 assert-css: (
118     "//*[@class='result-name']//*[text()='(keyword)']",
119     {"color": "rgb(221, 221, 221)"},
120 )
121
122 // Checking the color of "keyword".
123 assert-css: (
124     ".result-name .keyword",
125     {"color": "rgb(210, 153, 29)"},
126     ALL,
127 )
128 // Check the color of "struct".
129 assert-css: (
130     ".result-name .struct",
131     {"color": "rgb(45, 191, 184)"},
132     ALL,
133 )
134 // Check the color of "associated type".
135 assert-css: (
136     ".result-name .associatedtype",
137     {"color": "rgb(210, 153, 29)"},
138     ALL,
139 )
140 // Check the color of "type method".
141 assert-css: (
142     ".result-name .tymethod",
143     {"color": "rgb(43, 171, 99)"},
144     ALL,
145 )
146 // Check the color of "method".
147 assert-css: (
148     ".result-name .method",
149     {"color": "rgb(43, 171, 99)"},
150     ALL,
151 )
152 // Check the color of "struct field".
153 assert-css: (
154     ".result-name .structfield",
155     {"color": "rgb(221, 221, 221)"},
156     ALL,
157 )
158 // Check the color of "macro".
159 assert-css: (
160     ".result-name .macro",
161     {"color": "rgb(9, 189, 0)"},
162     ALL,
163 )
164 // Check the color of "fn".
165 assert-css: (
166     ".result-name .fn",
167     {"color": "rgb(43, 171, 99)"},
168     ALL,
169 )
170
171 // Checking the `<a>` container.
172 assert-css: (
173     "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
174     {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
175 )
176
177 // Checking color and background on hover.
178 move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
179 assert-css: (
180     "//*[@class='result-name']/*[text()='test_docs::']",
181     {"color": "rgb(221, 221, 221)"},
182 )
183 assert-css: (
184     "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
185     {"color": "rgb(221, 221, 221)", "background-color": "rgb(119, 119, 119)"},
186 )
187
188 // Light theme
189 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
190 reload:
191
192 // Waiting for the search results to appear...
193 wait-for: "#titles"
194 assert-css: (
195     "//*[@class='desc']//*[text()='Just a normal struct.']",
196     {"color": "rgb(0, 0, 0)"},
197 )
198 assert-css: (
199     "//*[@class='result-name']/*[text()='test_docs::']",
200     {"color": "rgb(0, 0, 0)"},
201 )
202
203 // Checking the color for "keyword".
204 assert-css: (
205     "//*[@class='result-name']//*[text()='(keyword)']",
206     {"color": "rgb(0, 0, 0)"},
207 )
208
209 // Checking the color of "keyword".
210 assert-css: (
211     ".result-name .keyword",
212     {"color": "rgb(56, 115, 173)"},
213     ALL,
214 )
215 // Check the color of "struct".
216 assert-css: (
217     ".result-name .struct",
218     {"color": "rgb(173, 55, 138)"},
219     ALL,
220 )
221 // Check the color of "associated type".
222 assert-css: (
223     ".result-name .associatedtype",
224     {"color": "rgb(56, 115, 173)"},
225     ALL,
226 )
227 // Check the color of "type method".
228 assert-css: (
229     ".result-name .tymethod",
230     {"color": "rgb(173, 124, 55)"},
231     ALL,
232 )
233 // Check the color of "method".
234 assert-css: (
235     ".result-name .method",
236     {"color": "rgb(173, 124, 55)"},
237     ALL,
238 )
239 // Check the color of "struct field".
240 assert-css: (
241     ".result-name .structfield",
242     {"color": "rgb(0, 0, 0)"},
243     ALL,
244 )
245 // Check the color of "macro".
246 assert-css: (
247     ".result-name .macro",
248     {"color": "rgb(6, 128, 0)"},
249     ALL,
250 )
251 // Check the color of "fn".
252 assert-css: (
253     ".result-name .fn",
254     {"color": "rgb(173, 124, 55)"},
255     ALL,
256 )
257
258 // Checking the `<a>` container.
259 assert-css: (
260     "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
261     {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
262 )
263
264 // Checking color and background on hover.
265 move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
266 assert-css: (
267     "//*[@class='result-name']/*[text()='test_docs::']",
268     {"color": "rgb(0, 0, 0)"},
269 )
270 assert-css: (
271     "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
272     {"color": "rgb(0, 0, 0)", "background-color": "rgb(221, 221, 221)"},
273 )
274
275 // Check the alias more specifically in the dark theme.
276 goto: file://|DOC_PATH|/test_docs/index.html
277 // We set the theme so we're sure that the correct values will be used, whatever the computer
278 // this test is running on.
279 local-storage: {
280     "rustdoc-theme": "dark",
281     "rustdoc-use-system-theme": "false",
282 }
283 // If the text isn't displayed, the browser doesn't compute color style correctly...
284 show-text: true
285 // We reload the page so the local storage settings are being used.
286 reload:
287 write: (".search-input", "thisisanalias")
288 // To be SURE that the search will be run.
289 press-key: 'Enter'
290 // Waiting for the search results to appear...
291 wait-for: "#titles"
292 // Checking that the colors for the alias element are the ones expected.
293 assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
294 assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})