2021-08-13 20:23:13 +08:00
|
|
|
// This test check for headers text and background colors for the different themes.
|
|
|
|
|
2022-10-18 21:18:45 +08:00
|
|
|
define-function: (
|
|
|
|
"check-colors",
|
|
|
|
(theme, color, code_header_color, focus_background_color, headings_color),
|
2023-01-06 22:18:51 +08:00
|
|
|
block {
|
2023-04-12 01:11:34 +08:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
|
2022-10-18 21:18:45 +08:00
|
|
|
// This is needed so that the text color is computed.
|
2023-01-06 22:18:51 +08:00
|
|
|
show-text: true
|
2023-04-12 01:11:34 +08:00
|
|
|
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
|
2023-01-06 22:18:51 +08:00
|
|
|
reload:
|
|
|
|
assert-css: (
|
2022-10-18 21:18:45 +08:00
|
|
|
".impl",
|
|
|
|
{"color": |color|, "background-color": "rgba(0, 0, 0, 0)"},
|
|
|
|
ALL,
|
2023-01-06 22:18:51 +08:00
|
|
|
)
|
|
|
|
assert-css: (
|
2022-10-18 21:18:45 +08:00
|
|
|
".impl .code-header",
|
|
|
|
{"color": |code_header_color|, "background-color": "rgba(0, 0, 0, 0)"},
|
|
|
|
ALL,
|
2023-01-06 22:18:51 +08:00
|
|
|
)
|
2023-04-12 01:11:34 +08:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
|
2023-01-06 22:18:51 +08:00
|
|
|
assert-css: (
|
2022-10-18 21:18:45 +08:00
|
|
|
"#impl-Foo",
|
|
|
|
{"color": |color|, "background-color": |focus_background_color|},
|
2023-01-06 22:18:51 +08:00
|
|
|
)
|
2023-04-12 01:11:34 +08:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
|
2023-01-06 22:18:51 +08:00
|
|
|
assert-css: (
|
2022-10-18 21:18:45 +08:00
|
|
|
"#method\.must_use",
|
|
|
|
{"color": |color|, "background-color": |focus_background_color|},
|
|
|
|
ALL,
|
2023-01-06 22:18:51 +08:00
|
|
|
)
|
2023-04-12 01:11:34 +08:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2023-01-06 22:18:51 +08:00
|
|
|
assert-css: (".small-section-header a", {"color": |color|}, ALL)
|
2023-04-12 01:11:34 +08:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
|
2022-10-18 21:18:45 +08:00
|
|
|
// We select headings (h2, h3, h...).
|
2023-01-06 22:18:51 +08:00
|
|
|
assert-css: (".docblock > :not(p) > a", {"color": |headings_color|}, ALL)
|
|
|
|
},
|
2021-12-13 01:28:58 +08:00
|
|
|
)
|
2021-08-13 20:23:13 +08:00
|
|
|
|
2022-10-18 21:18:45 +08:00
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "ayu",
|
2023-06-11 20:40:12 +08:00
|
|
|
"color": "#c5c5c5",
|
|
|
|
"code_header_color": "#e6e1cf",
|
2022-10-18 21:18:45 +08:00
|
|
|
"focus_background_color": "rgba(255, 236, 164, 0.06)",
|
2023-06-11 20:40:12 +08:00
|
|
|
"headings_color": "#39afd7",
|
2022-10-18 21:18:45 +08:00
|
|
|
},
|
2021-12-13 01:28:58 +08:00
|
|
|
)
|
2022-10-18 21:18:45 +08:00
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "dark",
|
2023-06-11 20:40:12 +08:00
|
|
|
"color": "#ddd",
|
|
|
|
"code_header_color": "#ddd",
|
|
|
|
"focus_background_color": "#494a3d",
|
|
|
|
"headings_color": "#d2991d",
|
2022-10-18 21:18:45 +08:00
|
|
|
},
|
2021-12-13 01:28:58 +08:00
|
|
|
)
|
2022-10-18 21:18:45 +08:00
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "light",
|
2023-06-11 20:40:12 +08:00
|
|
|
"color": "black",
|
|
|
|
"code_header_color": "black",
|
|
|
|
"focus_background_color": "#fdffd3",
|
|
|
|
"headings_color": "#3873ad",
|
2022-10-18 21:18:45 +08:00
|
|
|
},
|
2021-12-13 01:28:58 +08:00
|
|
|
)
|