2022-12-28 16:15:09 +00:00
|
|
|
// Check that scrape example code blocks have the expected colors.
|
2024-04-05 19:38:55 +00:00
|
|
|
include: "utils.goml"
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
|
2022-12-29 11:10:39 +00:00
|
|
|
show-text: true
|
2022-12-28 16:15:09 +00:00
|
|
|
|
|
|
|
define-function: (
|
|
|
|
"check-colors",
|
2024-04-01 19:11:22 +00:00
|
|
|
[theme, highlight, highlight_focus, help_border, help_color, help_hover_border,
|
|
|
|
help_hover_color],
|
2023-01-06 14:18:51 +00:00
|
|
|
block {
|
2024-04-05 19:38:55 +00:00
|
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
2023-01-06 14:18:51 +00:00
|
|
|
wait-for: ".more-examples-toggle"
|
|
|
|
assert-css: (".scraped-example .example-wrap .rust span.highlight:not(.focus)", {
|
2022-12-28 16:15:09 +00:00
|
|
|
"background-color": |highlight|,
|
2023-01-06 14:18:51 +00:00
|
|
|
}, ALL)
|
|
|
|
assert-css: (".scraped-example .example-wrap .rust span.highlight.focus", {
|
2022-12-28 16:15:09 +00:00
|
|
|
"background-color": |highlight_focus|,
|
2023-01-06 14:18:51 +00:00
|
|
|
}, ALL)
|
2022-12-29 11:10:39 +00:00
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: (".scraped-example-list .scrape-help", {
|
2022-12-29 11:10:39 +00:00
|
|
|
"border-color": |help_border|,
|
|
|
|
"color": |help_color|,
|
2023-01-06 14:18:51 +00:00
|
|
|
})
|
|
|
|
move-cursor-to: ".scraped-example-list .scrape-help"
|
|
|
|
assert-css: (".scraped-example-list .scrape-help:hover", {
|
2022-12-29 11:10:39 +00:00
|
|
|
"border-color": |help_hover_border|,
|
|
|
|
"color": |help_hover_color|,
|
2023-01-06 14:18:51 +00:00
|
|
|
})
|
2022-12-29 11:10:39 +00:00
|
|
|
// Moving the cursor to another item to not break next runs.
|
2023-01-06 14:18:51 +00:00
|
|
|
move-cursor-to: ".search-input"
|
|
|
|
}
|
2022-12-28 16:15:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
call-function: ("check-colors", {
|
|
|
|
"theme": "ayu",
|
2023-05-19 15:01:22 +00:00
|
|
|
"highlight": "#5b3b01",
|
|
|
|
"highlight_focus": "#7c4b0f",
|
|
|
|
"help_border": "#aaa",
|
|
|
|
"help_color": "#eee",
|
|
|
|
"help_hover_border": "#fff",
|
|
|
|
"help_hover_color": "#fff",
|
2022-12-28 16:15:09 +00:00
|
|
|
})
|
|
|
|
call-function: ("check-colors", {
|
|
|
|
"theme": "dark",
|
2023-05-19 15:01:22 +00:00
|
|
|
"highlight": "#5b3b01",
|
|
|
|
"highlight_focus": "#7c4b0f",
|
|
|
|
"help_border": "#aaa",
|
|
|
|
"help_color": "#eee",
|
|
|
|
"help_hover_border": "#fff",
|
|
|
|
"help_hover_color": "#fff",
|
2022-12-28 16:15:09 +00:00
|
|
|
})
|
|
|
|
call-function: ("check-colors", {
|
|
|
|
"theme": "light",
|
2023-05-19 15:01:22 +00:00
|
|
|
"highlight": "#fcffd6",
|
|
|
|
"highlight_focus": "#f6fdb0",
|
|
|
|
"help_border": "#555",
|
|
|
|
"help_color": "#333",
|
|
|
|
"help_hover_border": "#000",
|
|
|
|
"help_hover_color": "#000",
|
2022-12-28 16:15:09 +00:00
|
|
|
})
|
2023-01-21 11:16:02 +00:00
|
|
|
|
|
|
|
// Now testing the top and bottom background in case there is only one scraped examples.
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
|
2023-01-21 11:16:02 +00:00
|
|
|
|
|
|
|
define-function: (
|
|
|
|
"check-background",
|
2024-04-01 19:11:22 +00:00
|
|
|
[theme, background_color_start, background_color_end],
|
2023-01-21 11:16:02 +00:00
|
|
|
block {
|
2024-04-05 19:38:55 +00:00
|
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
2023-01-21 11:16:02 +00:00
|
|
|
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",
|
2023-05-22 15:34:48 +00:00
|
|
|
"background_color_start": "rgba(15, 20, 25, 1)",
|
2023-01-21 11:16:02 +00:00
|
|
|
"background_color_end": "rgba(15, 20, 25, 0)",
|
|
|
|
})
|
|
|
|
call-function: ("check-background", {
|
|
|
|
"theme": "dark",
|
2023-05-22 15:34:48 +00:00
|
|
|
"background_color_start": "rgba(53, 53, 53, 1)",
|
2023-01-21 11:16:02 +00:00
|
|
|
"background_color_end": "rgba(53, 53, 53, 0)",
|
|
|
|
})
|
|
|
|
call-function: ("check-background", {
|
|
|
|
"theme": "light",
|
2023-05-22 15:34:48 +00:00
|
|
|
"background_color_start": "rgba(255, 255, 255, 1)",
|
2023-01-21 11:16:02 +00:00
|
|
|
"background_color_end": "rgba(255, 255, 255, 0)",
|
|
|
|
})
|