about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-11-26 22:35:05 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-11-26 22:35:05 +0100
commitb19e0347453b9388266ecbcf6ec85d2c66e2f9f4 (patch)
treeeeee936eb02fab616ca796a733882157178e3215
parent80a96467ec5675e9f69683b5c075a8b15950c341 (diff)
downloadrust-b19e0347453b9388266ecbcf6ec85d2c66e2f9f4.tar.gz
rust-b19e0347453b9388266ecbcf6ec85d2c66e2f9f4.zip
Switch rustdoc-gui test to function call
-rw-r--r--src/test/rustdoc-gui/sidebar-mobile.goml46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/test/rustdoc-gui/sidebar-mobile.goml b/src/test/rustdoc-gui/sidebar-mobile.goml
index 453873f1b81..fc364017336 100644
--- a/src/test/rustdoc-gui/sidebar-mobile.goml
+++ b/src/test/rustdoc-gui/sidebar-mobile.goml
@@ -48,23 +48,35 @@ compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topb
 
 // Now checking the background color of the sidebar.
 show-text: true
-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
-reload:
 
-// Open the sidebar menu.
-click: ".sidebar-menu-toggle"
-assert-css: (".sidebar", {"background-color": "rgb(80, 80, 80)", "color": "rgb(221, 221, 221)"})
-
-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "ayu"}
-reload:
-
-// Open the sidebar menu.
-click: ".sidebar-menu-toggle"
-assert-css: (".sidebar", {"background-color": "rgb(20, 25, 31)", "color": "rgb(197, 197, 197)"})
+define-function: (
+    "check-colors",
+    (theme, color, background),
+    [
+        ("local-storage", {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}),
+        ("reload"),
 
-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "light"}
-reload:
+        // Open the sidebar menu.
+        ("click", ".sidebar-menu-toggle"),
+        ("assert-css", (".sidebar", {
+            "background-color": |background|,
+            "color": |color|,
+        })),
+    ],
+)
 
-// Open the sidebar menu.
-click: ".sidebar-menu-toggle"
-assert-css: (".sidebar", {"background-color": "rgb(245, 245, 245)", "color": "rgb(0, 0, 0)"})
+call-function: ("check-colors", {
+    "theme": "ayu",
+    "color": "rgb(197, 197, 197)",
+    "background": "rgb(20, 25, 31)",
+})
+call-function: ("check-colors", {
+    "theme": "dark",
+    "color": "rgb(221, 221, 221)",
+    "background": "rgb(80, 80, 80)",
+})
+call-function: ("check-colors", {
+    "theme": "light",
+    "color": "rgb(0, 0, 0)",
+    "background": "rgb(245, 245, 245)",
+})