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