Skip to content

Commit 9898793

Browse files
Update existing rustdoc-gui tests and add a new one
1 parent 2d968a1 commit 9898793

File tree

4 files changed

+248
-6
lines changed

4 files changed

+248
-6
lines changed

src/test/rustdoc-gui/pocket-menu.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ reload:
5656
click: "#help-button"
5757
assert-css: (
5858
"#help-button .popover",
59-
{"display": "block", "border-color": "rgb(210, 210, 210)"},
59+
{"display": "block", "border-color": "rgb(224, 224, 224)"},
6060
)
6161
compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"])
6262
compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"])

src/test/rustdoc-gui/search-filter.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ click: "#settings-menu"
6969
wait-for: "#settings"
7070
click: "#theme-dark"
7171
wait-for-css: ("#crate-search", {
72-
"border": "1px solid rgb(210, 210, 210)",
72+
"border": "1px solid rgb(224, 224, 224)",
7373
"color": "rgb(221, 221, 221)",
7474
"background-color": "rgb(53, 53, 53)",
7575
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
// This test ensures that the elements in ".search-form" have the expected display.
2+
goto: file://|DOC_PATH|/test_docs/index.html
3+
show-text: true
4+
5+
// Ayu theme
6+
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 > button",
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 > button",
51+
{
52+
"color": "rgb(255, 255, 255)",
53+
"border-color": "rgb(224, 224, 224)",
54+
"background-color": "rgb(20, 25, 32)",
55+
},
56+
)
57+
58+
assert-css: (
59+
"#settings-menu",
60+
{"border-color": "rgb(197, 197, 197)"},
61+
)
62+
assert-css: (
63+
"#settings-menu > a",
64+
{
65+
"color": "rgb(255, 255, 255)",
66+
"border-color": "rgb(92, 103, 115)",
67+
"background-color": "rgb(20, 25, 32)",
68+
},
69+
)
70+
move-cursor-to: "#settings-menu"
71+
assert-css: (
72+
"#settings-menu:hover",
73+
{"border-color": "rgb(197, 197, 197)"},
74+
)
75+
// Only "border-color" should change.
76+
assert-css: (
77+
"#settings-menu:hover > a",
78+
{
79+
"color": "rgb(255, 255, 255)",
80+
"border-color": "rgb(224, 224, 224)",
81+
"background-color": "rgb(20, 25, 32)",
82+
},
83+
)
84+
85+
// Dark theme
86+
local-storage: {
87+
"rustdoc-theme": "dark",
88+
"rustdoc-use-system-theme": "false",
89+
}
90+
reload:
91+
92+
assert-css: (
93+
".search-input",
94+
{
95+
"border-color": "rgb(240, 240, 240)",
96+
"background-color": "rgb(240, 240, 240)",
97+
"color": "rgb(17, 17, 17)",
98+
},
99+
)
100+
focus: ".search-input"
101+
// Only "border-color" should change.
102+
assert-css: (
103+
".search-input",
104+
{
105+
"border-color": "rgb(0, 141, 253)",
106+
"background-color": "rgb(240, 240, 240)",
107+
"color": "rgb(17, 17, 17)",
108+
},
109+
)
110+
111+
assert-css: (
112+
"#help-button",
113+
{"border-color": "rgb(221, 221, 221)"},
114+
)
115+
assert-css: (
116+
"#help-button > button",
117+
{
118+
"color": "rgb(0, 0, 0)",
119+
"border-color": "rgb(224, 224, 224)",
120+
"background-color": "rgb(240, 240, 240)",
121+
},
122+
)
123+
move-cursor-to: "#help-button"
124+
assert-css: (
125+
"#help-button:hover",
126+
{"border-color": "rgb(221, 221, 221)"},
127+
)
128+
// Only "border-color" should change.
129+
assert-css: (
130+
"#help-button:hover > button",
131+
{
132+
"color": "rgb(0, 0, 0)",
133+
"border-color": "rgb(255, 185, 0)",
134+
"background-color": "rgb(240, 240, 240)",
135+
},
136+
)
137+
138+
assert-css: (
139+
"#settings-menu",
140+
{"border-color": "rgb(221, 221, 221)"},
141+
)
142+
assert-css: (
143+
"#settings-menu > a",
144+
{
145+
"color": "rgb(0, 0, 0)",
146+
"border-color": "rgb(224, 224, 224)",
147+
"background-color": "rgb(240, 240, 240)",
148+
},
149+
)
150+
move-cursor-to: "#settings-menu"
151+
assert-css: (
152+
"#settings-menu:hover",
153+
{"border-color": "rgb(221, 221, 221)"},
154+
)
155+
// Only "border-color" should change.
156+
assert-css: (
157+
"#settings-menu:hover > a",
158+
{
159+
"color": "rgb(0, 0, 0)",
160+
"border-color": "rgb(255, 185, 0)",
161+
"background-color": "rgb(240, 240, 240)",
162+
},
163+
)
164+
165+
// Light theme
166+
local-storage: {
167+
"rustdoc-theme": "light",
168+
"rustdoc-use-system-theme": "false",
169+
}
170+
reload:
171+
172+
assert-css: (
173+
".search-input",
174+
{
175+
"border-color": "rgb(224, 224, 224)",
176+
"background-color": "rgb(255, 255, 255)",
177+
"color": "rgb(0, 0, 0)",
178+
},
179+
)
180+
focus: ".search-input"
181+
// Nothing should change.
182+
assert-css: (
183+
".search-input",
184+
{
185+
"border-color": "rgb(102, 175, 233)",
186+
"background-color": "rgb(255, 255, 255)",
187+
"color": "rgb(0, 0, 0)",
188+
},
189+
)
190+
191+
assert-css: (
192+
"#help-button",
193+
{"border-color": "rgb(0, 0, 0)"},
194+
)
195+
assert-css: (
196+
"#help-button > button",
197+
{
198+
"color": "rgb(0, 0, 0)",
199+
"border-color": "rgb(224, 224, 224)",
200+
"background-color": "rgb(255, 255, 255)",
201+
},
202+
)
203+
move-cursor-to: "#help-button"
204+
assert-css: (
205+
"#help-button:hover",
206+
{"border-color": "rgb(0, 0, 0)"},
207+
)
208+
// Only "border-color" should change.
209+
assert-css: (
210+
"#help-button:hover > button",
211+
{
212+
"color": "rgb(0, 0, 0)",
213+
"border-color": "rgb(113, 113, 113)",
214+
"background-color": "rgb(255, 255, 255)",
215+
},
216+
)
217+
218+
assert-css: (
219+
"#settings-menu",
220+
{"border-color": "rgb(0, 0, 0)"},
221+
)
222+
assert-css: (
223+
"#settings-menu > a",
224+
{
225+
"color": "rgb(56, 115, 173)",
226+
"border-color": "rgb(224, 224, 224)",
227+
"background-color": "rgb(255, 255, 255)",
228+
},
229+
)
230+
move-cursor-to: "#settings-menu"
231+
assert-css: (
232+
"#settings-menu:hover",
233+
{"border-color": "rgb(0, 0, 0)"},
234+
)
235+
// Only "border-color" should change.
236+
assert-css: (
237+
"#settings-menu:hover > a",
238+
{
239+
"color": "rgb(56, 115, 173)",
240+
"border-color": "rgb(113, 113, 113)",
241+
"background-color": "rgb(255, 255, 255)",
242+
},
243+
)

src/test/rustdoc-gui/search-input.goml

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
33
local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
44
reload:
55

6-
assert-css: (".search-input", {"border-color": "rgb(224, 224, 224)"})
6+
assert-css: (".search-input", {"border-color": "rgb(240, 240, 240)"})
77
click: ".search-input"
8-
focus: ".search-input"
98
assert-css: (".search-input", {"border-color": "rgb(0, 141, 253)"})
109

1110
local-storage: {"rustdoc-theme": "light"}
@@ -18,6 +17,6 @@ assert-css: (".search-input", {"border-color": "rgb(102, 175, 233)"})
1817
local-storage: {"rustdoc-theme": "ayu"}
1918
reload:
2019

21-
assert-css: (".search-input", {"border-color": "rgb(66, 76, 87)"})
20+
assert-css: (".search-input", {"border-color": "rgb(92, 103, 115)"})
2221
click: ".search-input"
23-
assert-css: (".search-input", {"border-color": "rgb(66, 76, 87)"})
22+
assert-css: (".search-input", {"border-color": "rgb(92, 103, 115)"})

0 commit comments

Comments
 (0)