Skip to content

Commit 372ad13

Browse files
Extend rustdoc GUI test for scraped examples top and bottom "borders"
1 parent 397e4b1 commit 372ad13

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/rustdoc-gui/scrape-examples-color.goml

+36
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,39 @@ call-function: ("check-colors", {
5858
"help_hover_border": "rgb(0, 0, 0)",
5959
"help_hover_color": "rgb(0, 0, 0)",
6060
})
61+
62+
// Now testing the top and bottom background in case there is only one scraped examples.
63+
goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
64+
65+
define-function: (
66+
"check-background",
67+
(theme, background_color_start, background_color_end),
68+
block {
69+
local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }
70+
reload:
71+
assert-css: (".scraped-example:not(.expanded) .code-wrapper::before", {
72+
"background-image": "linear-gradient(" + |background_color_start| + ", " +
73+
|background_color_end| + ")",
74+
})
75+
assert-css: (".scraped-example:not(.expanded) .code-wrapper::after", {
76+
"background-image": "linear-gradient(to top, " + |background_color_start| + ", " +
77+
|background_color_end| + ")",
78+
})
79+
},
80+
)
81+
82+
call-function: ("check-background", {
83+
"theme": "ayu",
84+
"background_color_start": "rgb(15, 20, 25)",
85+
"background_color_end": "rgba(15, 20, 25, 0)",
86+
})
87+
call-function: ("check-background", {
88+
"theme": "dark",
89+
"background_color_start": "rgb(53, 53, 53)",
90+
"background_color_end": "rgba(53, 53, 53, 0)",
91+
})
92+
call-function: ("check-background", {
93+
"theme": "light",
94+
"background_color_start": "rgb(255, 255, 255)",
95+
"background_color_end": "rgba(255, 255, 255, 0)",
96+
})

0 commit comments

Comments
 (0)