summaryrefslogtreecommitdiff
path: root/tests/rustdoc-gui/code-color.goml
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-05 09:13:28 +0100
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-11 09:32:08 +0000
commitcf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch)
tree40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/rustdoc-gui/code-color.goml
parentca855e6e42787ecd062d81d53336fe6788ef51a9 (diff)
downloadrust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz
Move /src/test to /tests
Diffstat (limited to 'tests/rustdoc-gui/code-color.goml')
-rw-r--r--tests/rustdoc-gui/code-color.goml24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/code-color.goml b/tests/rustdoc-gui/code-color.goml
new file mode 100644
index 00000000000..cb550a4573a
--- /dev/null
+++ b/tests/rustdoc-gui/code-color.goml
@@ -0,0 +1,24 @@
+// 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.
+//
+// While we're at it, we also check it for the other themes.
+goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
+// If the text isn't displayed, the browser doesn't compute color style correctly...
+show-text: true
+
+define-function: (
+ "check-colors",
+ (theme, doc_code_color, doc_inline_code_color),
+ block {
+ // Set the theme.
+ local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
+ // We reload the page so the local storage settings are being used.
+ reload:
+ assert-css: (".docblock pre > code", {"color": |doc_code_color|}, ALL)
+ assert-css: (".docblock > p > code", {"color": |doc_inline_code_color|}, ALL)
+ },
+)
+
+call-function: ("check-colors", ("ayu", "rgb(230, 225, 207)", "rgb(255, 180, 84)"))
+call-function: ("check-colors", ("dark", "rgb(221, 221, 221)", "rgb(221, 221, 221)"))
+call-function: ("check-colors", ("light", "rgb(0, 0, 0)", "rgb(0, 0, 0)"))