Skip to content

Commit 46b4b37

Browse files
Add GUI test to check ayu <code> colors
1 parent 749cd8f commit 46b4b37

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
goto: file://|DOC_PATH|/test_docs/enum.AnEnum.html
4+
// We need to show the text, otherwise the colors aren't "computed" by the web browser.
5+
show-text: true
6+
// We set the theme to ayu.
7+
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
8+
// We reload to get the text appearing and the theme applied.
9+
reload:
10+
11+
assert-css: (".docblock code", {"color": "rgb(255, 180, 84)"}, ALL)
12+
// It includes variants and the "titles" as well (for example: "impl RefUnwindSafe for AnEnum").
13+
assert-css: ("div:not(.docblock) > code", {"color": "rgb(197, 197, 197)"}, ALL)

src/test/rustdoc-gui/src/test_docs/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ pub fn check_list_code_block() {}
9696
#[doc(cfg(unix))]
9797
pub fn replaced_function() {}
9898

99+
/// Some doc with `code`!
99100
pub enum AnEnum {
100101
WithVariants { and: usize, sub: usize, variants: usize },
101102
}

0 commit comments

Comments
 (0)