Skip to content

Commit aa20f88

Browse files
Add GUI test for scraped examples colors
1 parent c3eb202 commit aa20f88

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Check that scrape example code blocks have the expected colors.
2+
goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
3+
4+
define-function: (
5+
"check-colors",
6+
(theme, highlight, highlight_focus),
7+
[
8+
("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }),
9+
("reload"),
10+
("wait-for", ".more-examples-toggle"),
11+
("assert-css", (".scraped-example .example-wrap .rust span.highlight:not(.focus)", {
12+
"background-color": |highlight|,
13+
}, ALL)),
14+
("assert-css", (".scraped-example .example-wrap .rust span.highlight.focus", {
15+
"background-color": |highlight_focus|,
16+
}, ALL)),
17+
]
18+
)
19+
20+
call-function: ("check-colors", {
21+
"theme": "ayu",
22+
"highlight": "rgb(91, 59, 1)",
23+
"highlight_focus": "rgb(124, 75, 15)",
24+
})
25+
call-function: ("check-colors", {
26+
"theme": "dark",
27+
"highlight": "rgb(91, 59, 1)",
28+
"highlight_focus": "rgb(124, 75, 15)",
29+
})
30+
call-function: ("check-colors", {
31+
"theme": "light",
32+
"highlight": "rgb(252, 255, 214)",
33+
"highlight_focus": "rgb(246, 253, 176)",
34+
})

0 commit comments

Comments
 (0)