about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-12-24 08:29:17 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-12-24 08:29:17 +0100
commit457f6c8332428fddfa6ac94b78394ed5d0a116b4 (patch)
tree79ba52daf7d487655b4566dcf801aa0ae3c8b3e4 /src/test
parent518ca9c16f87435dca9db434a0d6d8f5d6a6d1e8 (diff)
downloadrust-457f6c8332428fddfa6ac94b78394ed5d0a116b4.tar.gz
rust-457f6c8332428fddfa6ac94b78394ed5d0a116b4.zip
Extend GUI test for toggle-line background
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-gui/scrape-examples-toggle.goml44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/test/rustdoc-gui/scrape-examples-toggle.goml b/src/test/rustdoc-gui/scrape-examples-toggle.goml
index ee720afb788..9bb338d7129 100644
--- a/src/test/rustdoc-gui/scrape-examples-toggle.goml
+++ b/src/test/rustdoc-gui/scrape-examples-toggle.goml
@@ -1,9 +1,45 @@
 goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
 
-// Clicking "More examples..." will open additional examples
-assert-attribute-false: (".more-examples-toggle", {"open": ""})
-click: ".more-examples-toggle"
-assert-attribute: (".more-examples-toggle", {"open": ""})
+// Checking the color of the toggle line.
+show-text: true
+define-function: (
+    "check-color",
+    (theme, toggle_line_color, toggle_line_hover_color),
+    [
+        ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
+        ("reload"),
+
+        // Clicking "More examples..." will open additional examples
+        ("assert-attribute-false", (".more-examples-toggle", {"open": ""})),
+        ("click", ".more-examples-toggle"),
+        ("assert-attribute", (".more-examples-toggle", {"open": ""})),
+
+        ("assert-css", (".toggle-line-inner", {"background-color": |toggle_line_color|}, ALL)),
+        ("move-cursor-to", ".toggle-line"),
+        ("assert-css", (
+            ".toggle-line:hover .toggle-line-inner",
+            {"background-color": |toggle_line_hover_color|},
+        )),
+        // Moving cursor away from the toggle line to prevent disrupting next test.
+        ("move-cursor-to", ".search-input"),
+    ],
+)
+
+call-function: ("check-color", {
+    "theme": "ayu",
+    "toggle_line_color": "rgb(153, 153, 153)",
+    "toggle_line_hover_color": "rgb(197, 197, 197)",
+})
+call-function: ("check-color", {
+    "theme": "dark",
+    "toggle_line_color": "rgb(153, 153, 153)",
+    "toggle_line_hover_color": "rgb(197, 197, 197)",
+})
+call-function: ("check-color", {
+    "theme": "light",
+    "toggle_line_color": "rgb(204, 204, 204)",
+    "toggle_line_hover_color": "rgb(153, 153, 153)",
+})
 
 // Toggling all docs will close additional examples
 click: "#toggle-all-docs"