Skip to content

Commit

Permalink
Add GUI test to check ayu <code> colors
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jul 14, 2021
1 parent 749cd8f commit 46b4b37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/rustdoc-gui/ayu-code-tag-colors.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// The ayu theme has a different color for the "<code>" tags in the doc blocks. We need to
// check that the rule isn't applied on other "<code>" elements.
goto: file://|DOC_PATH|/test_docs/enum.AnEnum.html
// We need to show the text, otherwise the colors aren't "computed" by the web browser.
show-text: true
// We set the theme to ayu.
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
// We reload to get the text appearing and the theme applied.
reload:

assert-css: (".docblock code", {"color": "rgb(255, 180, 84)"}, ALL)
// It includes variants and the "titles" as well (for example: "impl RefUnwindSafe for AnEnum").
assert-css: ("div:not(.docblock) > code", {"color": "rgb(197, 197, 197)"}, ALL)
1 change: 1 addition & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub fn check_list_code_block() {}
#[doc(cfg(unix))]
pub fn replaced_function() {}

/// Some doc with `code`!
pub enum AnEnum {
WithVariants { and: usize, sub: usize, variants: usize },
}
Expand Down

0 comments on commit 46b4b37

Please sign in to comment.