about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-10-23 14:48:18 -0700
committerGitHub <noreply@github.com>2022-10-23 14:48:18 -0700
commit296700eec55946c6beb435f6644d658d8aae1593 (patch)
tree92d31313d21e4690a6eff0ed6eec3416acf572ff /src
parent88e0546a4c33e3420a4773efab43d10f729dc8fd (diff)
parentf112c3a4186868c02c583eb1094bd4e7bb082357 (diff)
downloadrust-296700eec55946c6beb435f6644d658d8aae1593.tar.gz
rust-296700eec55946c6beb435f6644d658d8aae1593.zip
Rollup merge of #103434 - GuillaumeGomez:gui-test-jump-to-def-background-cleanup, r=notriddle
Use functions for jump-to-def-background rustdoc GUI test

r? `@notriddle`
Diffstat (limited to 'src')
-rw-r--r--src/test/rustdoc-gui/jump-to-def-background.goml55
1 files changed, 17 insertions, 38 deletions
diff --git a/src/test/rustdoc-gui/jump-to-def-background.goml b/src/test/rustdoc-gui/jump-to-def-background.goml
index 31c7d0ce3c8..b65faf13d0c 100644
--- a/src/test/rustdoc-gui/jump-to-def-background.goml
+++ b/src/test/rustdoc-gui/jump-to-def-background.goml
@@ -1,43 +1,22 @@
 // We check the background color on the jump to definition links in the source code page.
 goto: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html"
 
-// 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: (
-    "body.source .example-wrap pre.rust a",
-    {"background-color": "rgb(51, 51, 51)"},
-    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: (
-    "body.source .example-wrap pre.rust a",
-    {"background-color": "rgb(51, 51, 51)"},
-    ALL,
+define-function: (
+    "check-background-color",
+    (theme, background_color),
+    [
+        // 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", (
+            "body.source .example-wrap pre.rust a",
+            {"background-color": |background_color|},
+            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: (
-    "body.source .example-wrap pre.rust a",
-    {"background-color": "rgb(238, 238, 238)"},
-    ALL,
-)
+call-function: ("check-background-color", ("ayu", "rgb(51, 51, 51)"))
+call-function: ("check-background-color", ("dark", "rgb(51, 51, 51)"))
+call-function: ("check-background-color", ("light", "rgb(238, 238, 238)"))