2021-11-25 14:39:04 +00:00
|
|
|
// This test is to ensure that the anchors (`§`) have the expected color and position.
|
2021-11-22 05:10:12 +00:00
|
|
|
|
2022-10-16 13:15:03 +00:00
|
|
|
define-function: (
|
|
|
|
"check-colors",
|
|
|
|
(theme, main_color, title_color, fqn_color, fqn_type_color, src_link_color, sidebar_link_color),
|
2023-01-06 14:18:51 +00:00
|
|
|
block {
|
|
|
|
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
|
2022-10-16 13:15:03 +00:00
|
|
|
// This is needed to ensure that the text color is computed.
|
2023-01-06 14:18:51 +00:00
|
|
|
show-text: true
|
2022-10-16 13:15:03 +00:00
|
|
|
|
|
|
|
// Setting the theme.
|
2023-01-06 14:18:51 +00:00
|
|
|
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
|
2022-10-16 13:15:03 +00:00
|
|
|
// We reload the page so the local storage settings are being used.
|
2023-01-06 14:18:51 +00:00
|
|
|
reload:
|
2022-10-16 13:15:03 +00:00
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: ("#toggle-all-docs", {"color": |main_color|})
|
|
|
|
assert-css: (".fqn a:nth-of-type(1)", {"color": |fqn_color|})
|
|
|
|
assert-css: (".fqn a:nth-of-type(2)", {"color": |fqn_type_color|})
|
|
|
|
assert-css: (
|
2022-10-16 13:15:03 +00:00
|
|
|
".rightside .srclink",
|
|
|
|
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
|
|
|
|
ALL,
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
compare-elements-css: (
|
|
|
|
".rightside .srclink",
|
|
|
|
".rightside.srclink",
|
|
|
|
["color", "text-decoration"],
|
|
|
|
)
|
|
|
|
compare-elements-css: (
|
|
|
|
".main-heading .srclink",
|
|
|
|
".rightside.srclink",
|
|
|
|
["color", "text-decoration"],
|
|
|
|
)
|
2022-10-16 13:15:03 +00:00
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
move-cursor-to: ".main-heading .srclink"
|
|
|
|
assert-css: (
|
2022-10-16 13:15:03 +00:00
|
|
|
".main-heading .srclink",
|
|
|
|
{"color": |src_link_color|, "text-decoration": "underline solid " + |src_link_color|},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
move-cursor-to: ".impl-items .rightside .srclink"
|
|
|
|
assert-css: (
|
2022-10-16 13:15:03 +00:00
|
|
|
".impl-items .rightside .srclink",
|
|
|
|
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
move-cursor-to: ".impl-items .rightside.srclink"
|
|
|
|
assert-css: (
|
2022-10-16 13:15:03 +00:00
|
|
|
".impl-items .rightside.srclink",
|
|
|
|
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
2022-10-16 13:15:03 +00:00
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
|
2022-10-16 13:15:03 +00:00
|
|
|
// Since we changed page, we need to set the theme again.
|
2023-01-06 14:18:51 +00:00
|
|
|
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
|
2022-10-16 13:15:03 +00:00
|
|
|
// We reload the page so the local storage settings are being used.
|
2023-01-06 14:18:51 +00:00
|
|
|
reload:
|
2022-10-16 13:15:03 +00:00
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: ("#top-doc-prose-title", {"color": |title_color|})
|
2022-10-16 13:15:03 +00:00
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: (".sidebar a", {"color": |sidebar_link_color|})
|
|
|
|
assert-css: ("h1.fqn a", {"color": |title_color|})
|
2022-10-16 13:15:03 +00:00
|
|
|
|
|
|
|
// We move the cursor over the "Implementations" title so the anchor is displayed.
|
2023-01-06 14:18:51 +00:00
|
|
|
move-cursor-to: "h2#implementations"
|
|
|
|
assert-css: ("h2#implementations a.anchor", {"color": |main_color|})
|
2022-10-16 13:15:03 +00:00
|
|
|
|
|
|
|
// Same thing with the impl block title.
|
2023-01-06 14:18:51 +00:00
|
|
|
move-cursor-to: "#impl-HeavilyDocumentedStruct"
|
|
|
|
assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": |main_color|})
|
2022-10-16 13:15:03 +00:00
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
|
|
|
|
},
|
2022-08-24 18:25:12 +00:00
|
|
|
)
|
|
|
|
|
2022-10-16 13:15:03 +00:00
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
2022-10-17 16:08:53 +00:00
|
|
|
{
|
|
|
|
"theme": "ayu",
|
|
|
|
"main_color": "rgb(197, 197, 197)",
|
|
|
|
"title_color": "rgb(255, 255, 255)",
|
|
|
|
"fqn_color": "rgb(255, 255, 255)",
|
|
|
|
"fqn_type_color": "rgb(255, 160, 165)",
|
|
|
|
"src_link_color": "rgb(57, 175, 215)",
|
|
|
|
"sidebar_link_color": "rgb(83, 177, 219)",
|
|
|
|
},
|
2022-08-24 18:25:12 +00:00
|
|
|
)
|
2022-10-16 13:15:03 +00:00
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
2022-10-17 16:08:53 +00:00
|
|
|
{
|
|
|
|
"theme": "dark",
|
|
|
|
"main_color": "rgb(221, 221, 221)",
|
|
|
|
"title_color": "rgb(221, 221, 221)",
|
|
|
|
"fqn_color": "rgb(221, 221, 221)",
|
|
|
|
"fqn_type_color": "rgb(45, 191, 184)",
|
|
|
|
"src_link_color": "rgb(210, 153, 29)",
|
|
|
|
"sidebar_link_color": "rgb(253, 191, 53)",
|
|
|
|
},
|
2022-08-24 18:25:12 +00:00
|
|
|
)
|
2022-10-16 13:15:03 +00:00
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
2022-10-17 16:08:53 +00:00
|
|
|
{
|
|
|
|
"theme": "light",
|
|
|
|
"main_color": "rgb(0, 0, 0)",
|
|
|
|
"title_color": "rgb(0, 0, 0)",
|
|
|
|
"fqn_color": "rgb(0, 0, 0)",
|
|
|
|
"fqn_type_color": "rgb(173, 55, 138)",
|
|
|
|
"src_link_color": "rgb(56, 115, 173)",
|
|
|
|
"sidebar_link_color": "rgb(53, 109, 164)",
|
|
|
|
},
|
2022-08-24 18:25:12 +00:00
|
|
|
)
|