about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2021-08-28 11:43:55 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-08-28 11:44:02 +0200
commit261ee26ac53c5fc034587d2a3710142991da8249 (patch)
treee026a6679be3470adeb6b36db6f5800a1e92b059 /src
parent1c3aedd23ab89b03bae389ec501845d03da63015 (diff)
downloadrust-261ee26ac53c5fc034587d2a3710142991da8249.tar.gz
rust-261ee26ac53c5fc034587d2a3710142991da8249.zip
Add test for code blocks color
Diffstat (limited to 'src')
-rw-r--r--src/test/rustdoc-gui/ayu-code-tag-colors.goml13
-rw-r--r--src/test/rustdoc-gui/code-color.goml30
2 files changed, 30 insertions, 13 deletions
diff --git a/src/test/rustdoc-gui/ayu-code-tag-colors.goml b/src/test/rustdoc-gui/ayu-code-tag-colors.goml
deleted file mode 100644
index 50af36fa3d6..00000000000
--- a/src/test/rustdoc-gui/ayu-code-tag-colors.goml
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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)
diff --git a/src/test/rustdoc-gui/code-color.goml b/src/test/rustdoc-gui/code-color.goml
new file mode 100644
index 00000000000..2f95bfb6b17
--- /dev/null
+++ b/src/test/rustdoc-gui/code-color.goml
@@ -0,0 +1,30 @@
+// 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
+// Set the theme to dark.
+local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: (".docblock pre > code", {"color": "rgb(221, 221, 221)"}, ALL)
+assert-css: (".docblock > p > code", {"color": "rgb(221, 221, 221)"}, ALL)
+
+// Set the theme to ayu.
+local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: (".docblock pre > code", {"color": "rgb(230, 225, 207)"}, ALL)
+assert-css: (".docblock > p > code", {"color": "rgb(255, 180, 84)"}, ALL)
+
+// Set the theme to light.
+local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: (".docblock pre > code", {"color": "rgb(0, 0, 0)"}, ALL)
+assert-css: (".docblock > p > code", {"color": "rgb(0, 0, 0)"}, ALL)