Skip to content

Commit f0169e9

Browse files
Add test for search results colors
1 parent b09084c commit f0169e9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
9+
reload:
10+
11+
// Waiting for the search results to appear...
12+
wait-for: "#titles"
13+
assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(197, 197, 197)"})
14+
assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 150, 207)"})
15+
16+
// Dark theme
17+
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
18+
reload:
19+
20+
// Waiting for the search results to appear...
21+
wait-for: "#titles"
22+
assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(221, 221, 221)"})
23+
assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(221, 221, 221)"})
24+
25+
// Light theme
26+
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
27+
reload:
28+
29+
// Waiting for the search results to appear...
30+
wait-for: "#titles"
31+
assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(0, 0, 0)"})
32+
assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 0, 0)"})

0 commit comments

Comments
 (0)