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-12-29 13:16:03 +0100
committerGitHub <noreply@github.com>2022-12-29 13:16:03 +0100
commit2c4560cb1229d2edb07ed045003fbdb4cb955ac0 (patch)
treeb935fe488bfb1c41a464f4311e2fb46393afb9f8 /src/test/rustdoc-gui
parentbdf37b7bbbf553237729cec444a3b2be06ef807e (diff)
parentaa20f885c4abaa8a13f0adcc5d5738b895cc84a8 (diff)
Rollup merge of #106218 - GuillaumeGomez:migrate-css-var-scraped-examples, r=notriddle
Migrate css var scraped examples

r? ``@notriddle``
Diffstat (limited to 'src/test/rustdoc-gui')
-rw-r--r--src/test/rustdoc-gui/scrape-examples-color.goml34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/scrape-examples-color.goml b/src/test/rustdoc-gui/scrape-examples-color.goml
new file mode 100644
index 00000000000..5175891e7ba
--- /dev/null
+++ b/src/test/rustdoc-gui/scrape-examples-color.goml
@@ -0,0 +1,34 @@
+// Check that scrape example code blocks have the expected colors.
+goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
+
+define-function: (
+    "check-colors",
+    (theme, highlight, highlight_focus),
+    [
+        ("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }),
+        ("reload"),
+        ("wait-for", ".more-examples-toggle"),
+        ("assert-css", (".scraped-example .example-wrap .rust span.highlight:not(.focus)", {
+            "background-color": |highlight|,
+        }, ALL)),
+        ("assert-css", (".scraped-example .example-wrap .rust span.highlight.focus", {
+            "background-color": |highlight_focus|,
+        }, ALL)),
+    ]
+)
+
+call-function: ("check-colors", {
+    "theme": "ayu",
+    "highlight": "rgb(91, 59, 1)",
+    "highlight_focus": "rgb(124, 75, 15)",
+})
+call-function: ("check-colors", {
+    "theme": "dark",
+    "highlight": "rgb(91, 59, 1)",
+    "highlight_focus": "rgb(124, 75, 15)",
+})
+call-function: ("check-colors", {
+    "theme": "light",
+    "highlight": "rgb(252, 255, 214)",
+    "highlight_focus": "rgb(246, 253, 176)",
+})