about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-01-22 11:43:07 +0100
committerGitHub <noreply@github.com>2023-01-22 11:43:07 +0100
commitd41a14f91e414ad2cda57b2135e22231cec017e0 (patch)
tree556c09b7fb5fc0178afc114fd2c2d1f90ea6f32b /tests
parentd779a592dd13219c434b4ae2d1d65619ccfa23a1 (diff)
parent372ad130d595d50a8c79c836fcadc3b39d14859c (diff)
downloadrust-d41a14f91e414ad2cda57b2135e22231cec017e0.tar.gz
rust-d41a14f91e414ad2cda57b2135e22231cec017e0.zip
Rollup merge of #107152 - GuillaumeGomez:migrate-to-css-var, r=notriddle
Migrate scraped-examples top and bottom "borders" to CSS variables

r? `@notriddle`
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-gui/scrape-examples-color.goml36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/scrape-examples-color.goml b/tests/rustdoc-gui/scrape-examples-color.goml
index 40f31b2771b..67c58826efc 100644
--- a/tests/rustdoc-gui/scrape-examples-color.goml
+++ b/tests/rustdoc-gui/scrape-examples-color.goml
@@ -58,3 +58,39 @@ call-function: ("check-colors", {
     "help_hover_border": "rgb(0, 0, 0)",
     "help_hover_color": "rgb(0, 0, 0)",
 })
+
+// Now testing the top and bottom background in case there is only one scraped examples.
+goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
+
+define-function: (
+    "check-background",
+    (theme, background_color_start, background_color_end),
+    block {
+        local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }
+        reload:
+        assert-css: (".scraped-example:not(.expanded) .code-wrapper::before", {
+            "background-image": "linear-gradient(" + |background_color_start| + ", " +
+                |background_color_end| + ")",
+        })
+        assert-css: (".scraped-example:not(.expanded) .code-wrapper::after", {
+            "background-image": "linear-gradient(to top, " + |background_color_start| + ", " +
+                |background_color_end| + ")",
+        })
+    },
+)
+
+call-function: ("check-background", {
+    "theme": "ayu",
+    "background_color_start": "rgb(15, 20, 25)",
+    "background_color_end": "rgba(15, 20, 25, 0)",
+})
+call-function: ("check-background", {
+    "theme": "dark",
+    "background_color_start": "rgb(53, 53, 53)",
+    "background_color_end": "rgba(53, 53, 53, 0)",
+})
+call-function: ("check-background", {
+    "theme": "light",
+    "background_color_start": "rgb(255, 255, 255)",
+    "background_color_end": "rgba(255, 255, 255, 0)",
+})