about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2021-07-12 16:48:25 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-07-13 10:18:23 +0200
commitf0169e923b4c47b6fdf263d8e060a9c4e84c94e4 (patch)
tree7312f7c846026e680964ecc1cc872e8024a0c27a
parentb09084cbb6f391c2efe7da26c70983d810c23c33 (diff)
downloadrust-f0169e923b4c47b6fdf263d8e060a9c4e84c94e4.tar.gz
rust-f0169e923b4c47b6fdf263d8e060a9c4e84c94e4.zip
Add test for search results colors
-rw-r--r--src/test/rustdoc-gui/search-result-color.goml32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/search-result-color.goml b/src/test/rustdoc-gui/search-result-color.goml
new file mode 100644
index 00000000000..c138cc8d9c6
--- /dev/null
+++ b/src/test/rustdoc-gui/search-result-color.goml
@@ -0,0 +1,32 @@
+// The goal of this test is to ensure the color of the text is the one expected.
+goto: file://|DOC_PATH|/test_docs/index.html?search=coo
+
+// This is needed so that the text color is computed.
+show-text: true
+
+// Ayu theme
+local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
+reload:
+
+// Waiting for the search results to appear...
+wait-for: "#titles"
+assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(197, 197, 197)"})
+assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 150, 207)"})
+
+// Dark theme
+local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
+reload:
+
+// Waiting for the search results to appear...
+wait-for: "#titles"
+assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(221, 221, 221)"})
+assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(221, 221, 221)"})
+
+// Light theme
+local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
+reload:
+
+// Waiting for the search results to appear...
+wait-for: "#titles"
+assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(0, 0, 0)"})
+assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 0, 0)"})