Skip to content

Commit 4542711

Browse files
authored
Rollup merge of rust-lang#114999 - GuillaumeGomez:migrate-gui-test-color-34, r=notriddle
Migrate GUI colors test to original CSS color format Follow-up of rust-lang#111459. This test needed more cleanup: first I removed duplication by using a function, then I merge similar rules which had the same values. r? `@notriddle`
2 parents e25dfe1 + 03a3d24 commit 4542711

File tree

1 file changed

+131
-255
lines changed

1 file changed

+131
-255
lines changed

tests/rustdoc-gui/search-form-elements.goml

+131-255
Original file line numberDiff line numberDiff line change
@@ -2,262 +2,138 @@
22
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
33
show-text: true
44

5-
// Ayu theme
6-
set-local-storage: {
7-
"rustdoc-theme": "ayu",
8-
"rustdoc-use-system-theme": "false",
9-
}
10-
reload:
11-
12-
assert-css: (
13-
".search-input",
14-
{
15-
"border-color": "rgb(92, 103, 115)",
16-
"background-color": "rgb(20, 25, 32)",
17-
"color": "rgb(255, 255, 255)",
18-
},
19-
)
20-
focus: ".search-input"
21-
// Nothing should change.
22-
assert-css: (
23-
".search-input",
24-
{
25-
"border-color": "rgb(92, 103, 115)",
26-
"background-color": "rgb(20, 25, 32)",
27-
"color": "rgb(255, 255, 255)",
28-
},
29-
)
30-
31-
assert-css: (
32-
"#help-button",
33-
{"border-color": "rgb(197, 197, 197)"},
34-
)
35-
assert-css: (
36-
"#help-button > a",
37-
{
38-
"color": "rgb(255, 255, 255)",
39-
"border-color": "rgb(92, 103, 115)",
40-
"background-color": "rgb(20, 25, 32)",
41-
},
42-
)
43-
move-cursor-to: "#help-button"
44-
assert-css: (
45-
"#help-button:hover",
46-
{"border-color": "rgb(197, 197, 197)"},
47-
)
48-
// Only "border-color" should change.
49-
assert-css: (
50-
"#help-button:hover > a",
51-
{
52-
"color": "rgb(255, 255, 255)",
53-
"border-color": "rgb(224, 224, 224)",
54-
"background-color": "rgb(20, 25, 32)",
55-
},
56-
)
57-
// Link color inside
58-
click: "#help-button"
59-
assert-css: (
60-
"#help a",
61-
{
62-
"color": "rgb(57, 175, 215)",
63-
},
64-
)
65-
66-
assert-css: (
67-
"#settings-menu",
68-
{"border-color": "rgb(197, 197, 197)"},
69-
)
70-
assert-css: (
71-
"#settings-menu > a",
72-
{
73-
"border-color": "rgb(92, 103, 115)",
74-
"background-color": "rgb(20, 25, 32)",
75-
},
76-
)
77-
move-cursor-to: "#settings-menu"
78-
assert-css: (
79-
"#settings-menu:hover",
80-
{"border-color": "rgb(197, 197, 197)"},
81-
)
82-
// Only "border-color" should change.
83-
assert-css: (
84-
"#settings-menu:hover > a",
85-
{
86-
"border-color": "rgb(224, 224, 224)",
87-
"background-color": "rgb(20, 25, 32)",
88-
},
89-
)
90-
91-
// Dark theme
92-
set-local-storage: {
93-
"rustdoc-theme": "dark",
94-
"rustdoc-use-system-theme": "false",
95-
}
96-
reload:
97-
98-
assert-css: (
99-
".search-input",
100-
{
101-
"border-color": "rgb(224, 224, 224)",
102-
"background-color": "rgb(240, 240, 240)",
103-
"color": "rgb(17, 17, 17)",
104-
},
105-
)
106-
focus: ".search-input"
107-
// Only "border-color" should change.
108-
assert-css: (
109-
".search-input",
110-
{
111-
"border-color": "rgb(0, 141, 253)",
112-
"background-color": "rgb(240, 240, 240)",
113-
"color": "rgb(17, 17, 17)",
114-
},
115-
)
116-
117-
assert-css: (
118-
"#help-button",
119-
{"border-color": "rgb(221, 221, 221)"},
120-
)
121-
assert-css: (
122-
"#help-button > a",
123-
{
124-
"color": "rgb(0, 0, 0)",
125-
"border-color": "rgb(224, 224, 224)",
126-
"background-color": "rgb(240, 240, 240)",
127-
},
128-
)
129-
move-cursor-to: "#help-button"
130-
assert-css: (
131-
"#help-button:hover",
132-
{"border-color": "rgb(221, 221, 221)"},
133-
)
134-
// Only "border-color" should change.
135-
assert-css: (
136-
"#help-button:hover > a",
137-
{
138-
"color": "rgb(0, 0, 0)",
139-
"border-color": "rgb(255, 185, 0)",
140-
"background-color": "rgb(240, 240, 240)",
141-
},
142-
)
143-
// Link color inside
144-
click: "#help-button"
145-
assert-css: (
146-
"#help a",
147-
{
148-
"color": "rgb(210, 153, 29)",
5+
define-function: (
6+
"check-search-colors",
7+
(
8+
theme, border, background, search_input_color, search_input_border_focus,
9+
menu_button_border, menu_button_a_color, menu_button_a_border_hover, menu_a_color,
10+
),
11+
block {
12+
set-local-storage: {
13+
"rustdoc-theme": |theme|,
14+
"rustdoc-use-system-theme": "false",
15+
}
16+
reload:
17+
assert-css: (
18+
".search-input",
19+
{
20+
"border-color": |border|,
21+
"background-color": |background|,
22+
"color": |search_input_color|,
23+
},
24+
)
25+
// Focus on search input.
26+
focus: ".search-input"
27+
assert-css: (
28+
".search-input",
29+
{
30+
"border-color": |search_input_border_focus|,
31+
"background-color": |background|,
32+
"color": |search_input_color|,
33+
},
34+
)
35+
assert-css: (
36+
"#help-button",
37+
{"border-color": |menu_button_border|},
38+
)
39+
assert-css: (
40+
"#help-button > a",
41+
{
42+
"color": |menu_button_a_color|,
43+
"border-color": |border|,
44+
"background-color": |background|,
45+
},
46+
)
47+
// Hover help button.
48+
move-cursor-to: "#help-button"
49+
assert-css: (
50+
"#help-button:hover",
51+
{"border-color": |menu_button_border|},
52+
)
53+
assert-css: (
54+
"#help-button > a",
55+
{
56+
"color": |menu_button_a_color|,
57+
"border-color": |menu_button_a_border_hover|,
58+
"background-color": |background|,
59+
},
60+
)
61+
// Link color inside
62+
click: "#help-button"
63+
assert-css: (
64+
"#help a",
65+
{
66+
"color": |menu_a_color|,
67+
},
68+
)
69+
assert-css: (
70+
"#settings-menu",
71+
{"border-color": |menu_button_border|},
72+
)
73+
assert-css: (
74+
"#settings-menu > a",
75+
{
76+
"color": |menu_button_a_color|,
77+
"border-color": |border|,
78+
"background-color": |background|,
79+
},
80+
)
81+
// Hover settings menu.
82+
move-cursor-to: "#settings-menu"
83+
assert-css: (
84+
"#settings-menu:hover",
85+
{"border-color": |menu_button_border|},
86+
)
87+
assert-css: (
88+
"#settings-menu:hover > a",
89+
{
90+
"color": |menu_button_a_color|,
91+
"border-color": |menu_button_a_border_hover|,
92+
"background-color": |background|,
93+
},
94+
)
14995
},
15096
)
15197

152-
assert-css: (
153-
"#settings-menu",
154-
{"border-color": "rgb(221, 221, 221)"},
155-
)
156-
assert-css: (
157-
"#settings-menu > a",
158-
{
159-
"border-color": "rgb(224, 224, 224)",
160-
"background-color": "rgb(240, 240, 240)",
161-
},
162-
)
163-
move-cursor-to: "#settings-menu"
164-
assert-css: (
165-
"#settings-menu:hover",
166-
{"border-color": "rgb(221, 221, 221)"},
167-
)
168-
// Only "border-color" should change.
169-
assert-css: (
170-
"#settings-menu:hover > a",
171-
{
172-
"color": "rgb(0, 0, 0)",
173-
"border-color": "rgb(255, 185, 0)",
174-
"background-color": "rgb(240, 240, 240)",
175-
},
176-
)
177-
178-
// Light theme
179-
set-local-storage: {
180-
"rustdoc-theme": "light",
181-
"rustdoc-use-system-theme": "false",
182-
}
183-
reload:
184-
185-
assert-css: (
186-
".search-input",
187-
{
188-
"border-color": "rgb(224, 224, 224)",
189-
"background-color": "rgb(255, 255, 255)",
190-
"color": "rgb(0, 0, 0)",
191-
},
192-
)
193-
focus: ".search-input"
194-
// Nothing should change.
195-
assert-css: (
196-
".search-input",
197-
{
198-
"border-color": "rgb(102, 175, 233)",
199-
"background-color": "rgb(255, 255, 255)",
200-
"color": "rgb(0, 0, 0)",
201-
},
202-
)
203-
204-
assert-css: (
205-
"#help-button",
206-
{"border-color": "rgb(0, 0, 0)"},
207-
)
208-
assert-css: (
209-
"#help-button > a",
210-
{
211-
"color": "rgb(0, 0, 0)",
212-
"border-color": "rgb(224, 224, 224)",
213-
"background-color": "rgb(255, 255, 255)",
214-
},
215-
)
216-
move-cursor-to: "#help-button"
217-
assert-css: (
218-
"#help-button:hover",
219-
{"border-color": "rgb(0, 0, 0)"},
220-
)
221-
// Only "border-color" should change.
222-
assert-css: (
223-
"#help-button:hover > a",
224-
{
225-
"color": "rgb(0, 0, 0)",
226-
"border-color": "rgb(113, 113, 113)",
227-
"background-color": "rgb(255, 255, 255)",
228-
},
229-
)
230-
// Link color inside
231-
click: "#help-button"
232-
assert-css: (
233-
"#help a",
234-
{
235-
"color": "rgb(56, 115, 173)",
236-
},
237-
)
238-
239-
assert-css: (
240-
"#settings-menu",
241-
{"border-color": "rgb(0, 0, 0)"},
242-
)
243-
assert-css: (
244-
"#settings-menu > a",
245-
{
246-
"border-color": "rgb(224, 224, 224)",
247-
"background-color": "rgb(255, 255, 255)",
248-
},
249-
)
250-
move-cursor-to: "#settings-menu"
251-
assert-css: (
252-
"#settings-menu:hover",
253-
{"border-color": "rgb(0, 0, 0)"},
254-
)
255-
// Only "border-color" should change.
256-
assert-css: (
257-
"#settings-menu:hover > a",
258-
{
259-
"color": "rgb(0, 0, 0)",
260-
"border-color": "rgb(113, 113, 113)",
261-
"background-color": "rgb(255, 255, 255)",
262-
},
98+
call-function: (
99+
"check-search-colors",
100+
{
101+
"theme": "ayu",
102+
"border": "#5c6773",
103+
"background": "#141920",
104+
"search_input_color": "#fff",
105+
"search_input_border_focus": "#5c6773",
106+
"menu_button_border": "#c5c5c5",
107+
"menu_button_a_color": "#fff",
108+
"menu_button_a_border_hover": "#e0e0e0",
109+
"menu_a_color": "#39afd7",
110+
}
111+
)
112+
call-function: (
113+
"check-search-colors",
114+
{
115+
"theme": "dark",
116+
"border": "#e0e0e0",
117+
"background": "#f0f0f0",
118+
"search_input_color": "#111",
119+
"search_input_border_focus": "#008dfd",
120+
"menu_button_border": "#ddd",
121+
"menu_button_a_color": "#000",
122+
"menu_button_a_border_hover": "#ffb900",
123+
"menu_a_color": "#d2991d",
124+
}
125+
)
126+
call-function: (
127+
"check-search-colors",
128+
{
129+
"theme": "light",
130+
"border": "#e0e0e0",
131+
"background": "#fff",
132+
"search_input_color": "#000",
133+
"search_input_border_focus": "#66afe9",
134+
"menu_button_border": "#000",
135+
"menu_button_a_color": "#000",
136+
"menu_button_a_border_hover": "#717171",
137+
"menu_a_color": "#3873ad",
138+
}
263139
)

0 commit comments

Comments
 (0)