about summary refs log tree commit diff
path: root/src/test/rustdoc-gui
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-11-06 08:35:27 +0100
committerGitHub <noreply@github.com>2022-11-06 08:35:27 +0100
commitef0d79f8654e5d9b170844263ef73d2aa615fa50 (patch)
treeed0964163f1cd8d63ff2083423ee2045b341362d /src/test/rustdoc-gui
parentd93b5200d50a6cfb6bc0cba7504e6c1628c568f3 (diff)
parent8e2956d4a9787100ede2410f1d8d6b26d80ec961 (diff)
downloadrust-ef0d79f8654e5d9b170844263ef73d2aa615fa50.tar.gz
rust-ef0d79f8654e5d9b170844263ef73d2aa615fa50.zip
Rollup merge of #104014 - GuillaumeGomez:run-button-css-var, r=notriddle
Migrate test-arrow to CSS variables

There should be no UI changes. I kept both `color` and `background-color` properties even though only the ayu theme is actually completely making use of them on hover.

r? ``@notriddle``
Diffstat (limited to 'src/test/rustdoc-gui')
-rw-r--r--src/test/rustdoc-gui/run-on-hover.goml55
1 files changed, 51 insertions, 4 deletions
diff --git a/src/test/rustdoc-gui/run-on-hover.goml b/src/test/rustdoc-gui/run-on-hover.goml
index 6c785e1c4bb..57d63049f28 100644
--- a/src/test/rustdoc-gui/run-on-hover.goml
+++ b/src/test/rustdoc-gui/run-on-hover.goml
@@ -1,7 +1,54 @@
 // Example code blocks sometimes have a "Run" button to run them on the
 // Playground. That button is hidden until the user hovers over the code block.
-// This test checks that it is hidden, and that it shows on hover.
+// This test checks that it is hidden, and that it shows on hover. It also
+// checks for its color.
 goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
-assert-css: (".test-arrow", {"visibility": "hidden"})
-move-cursor-to: ".example-wrap"
-assert-css: (".test-arrow", {"visibility": "visible"})
+show-text: true
+
+define-function: (
+    "check-run-button",
+    (theme, color, background, hover_color, hover_background),
+    [
+        ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
+        ("reload"),
+        ("assert-css", (".test-arrow", {"visibility": "hidden"})),
+        ("move-cursor-to", ".example-wrap"),
+        ("assert-css", (".test-arrow", {
+            "visibility": "visible",
+            "color": |color|,
+            "background-color": |background|,
+            "font-size": "22px",
+            "border-radius": "5px",
+        })),
+        ("move-cursor-to", ".test-arrow"),
+        ("assert-css", (".test-arrow:hover", {
+            "visibility": "visible",
+            "color": |hover_color|,
+            "background-color": |hover_background|,
+            "font-size": "22px",
+            "border-radius": "5px",
+        })),
+    ],
+)
+
+call-function: ("check-run-button", {
+    "theme": "ayu",
+    "color": "rgb(120, 135, 151)",
+    "background": "rgba(57, 175, 215, 0.09)",
+    "hover_color": "rgb(197, 197, 197)",
+    "hover_background": "rgba(57, 175, 215, 0.37)",
+})
+call-function: ("check-run-button", {
+    "theme": "dark",
+    "color": "rgb(222, 222, 222)",
+    "background": "rgba(78, 139, 202, 0.2)",
+    "hover_color": "rgb(222, 222, 222)",
+    "hover_background": "rgb(78, 139, 202)",
+})
+call-function: ("check-run-button", {
+    "theme": "light",
+    "color": "rgb(245, 245, 245)",
+    "background": "rgba(78, 139, 202, 0.2)",
+    "hover_color": "rgb(245, 245, 245)",
+    "hover_background": "rgb(78, 139, 202)",
+})