Skip to content

Commit 261ee26

Browse files
Add test for code blocks color
1 parent 1c3aedd commit 261ee26

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed

src/test/rustdoc-gui/ayu-code-tag-colors.goml

-13
This file was deleted.

src/test/rustdoc-gui/code-color.goml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// The ayu theme has a different color for the "<code>" tags in the doc blocks. We need to
2+
// check that the rule isn't applied on other "<code>" elements.
3+
//
4+
// While we're at it, we also check it for the other themes.
5+
goto: file://|DOC_PATH|/test_docs/fn.foo.html
6+
// If the text isn't displayed, the browser doesn't compute color style correctly...
7+
show-text: true
8+
// Set the theme to dark.
9+
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
10+
// We reload the page so the local storage settings are being used.
11+
reload:
12+
13+
assert-css: (".docblock pre > code", {"color": "rgb(221, 221, 221)"}, ALL)
14+
assert-css: (".docblock > p > code", {"color": "rgb(221, 221, 221)"}, ALL)
15+
16+
// Set the theme to ayu.
17+
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
18+
// We reload the page so the local storage settings are being used.
19+
reload:
20+
21+
assert-css: (".docblock pre > code", {"color": "rgb(230, 225, 207)"}, ALL)
22+
assert-css: (".docblock > p > code", {"color": "rgb(255, 180, 84)"}, ALL)
23+
24+
// Set the theme to light.
25+
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
26+
// We reload the page so the local storage settings are being used.
27+
reload:
28+
29+
assert-css: (".docblock pre > code", {"color": "rgb(0, 0, 0)"}, ALL)
30+
assert-css: (".docblock > p > code", {"color": "rgb(0, 0, 0)"}, ALL)

0 commit comments

Comments
 (0)