about summary refs log tree commit diff
path: root/tests/rustdoc-gui/utils.goml
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-04-05 21:38:55 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-04-05 21:38:55 +0200
commit7659ef47f03f4e2bbbef65856427add98f898ef5 (patch)
treef2069567de13688a16cd07f8e61a75cf0f0da14f /tests/rustdoc-gui/utils.goml
parent5958f5e08fa88ee95ede8c00f1b89befe0372d54 (diff)
downloadrust-7659ef47f03f4e2bbbef65856427add98f898ef5.tar.gz
rust-7659ef47f03f4e2bbbef65856427add98f898ef5.zip
Use `include` command to reduce code duplication
Diffstat (limited to 'tests/rustdoc-gui/utils.goml')
-rw-r--r--tests/rustdoc-gui/utils.goml11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/utils.goml b/tests/rustdoc-gui/utils.goml
new file mode 100644
index 00000000000..d9f8726ec53
--- /dev/null
+++ b/tests/rustdoc-gui/utils.goml
@@ -0,0 +1,11 @@
+// This file contains code to be re-used by other tests.
+define-function: (
+    "switch-theme",
+    [theme],
+    block {
+        // Set the theme.
+        set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
+        // We reload the page so the local storage settings are being used.
+        reload:
+    },
+)