2021-11-25 14:39:04 +00:00
|
|
|
// This test is to ensure that the anchors (`§`) have the expected color and position.
|
2024-04-05 19:38:55 +00:00
|
|
|
include: "utils.goml"
|
2021-11-22 05:10:12 +00:00
|
|
|
|
2022-10-16 13:15:03 +00:00
|
|
|
define-function: (
|
|
|
|
"check-colors",
|
2024-04-01 19:11:22 +00:00
|
|
|
[theme, main_color, title_color, main_heading_color, main_heading_type_color, src_link_color, sidebar_link_color],
|
2023-01-06 14:18:51 +00:00
|
|
|
block {
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "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
|
|
|
|
2024-04-05 19:38:55 +00:00
|
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
2022-10-16 13:15:03 +00:00
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: ("#toggle-all-docs", {"color": |main_color|})
|
2023-01-13 17:09:25 +00:00
|
|
|
assert-css: (".main-heading h1 a:nth-of-type(1)", {"color": |main_heading_color|})
|
|
|
|
assert-css: (".main-heading a:nth-of-type(2)", {"color": |main_heading_type_color|})
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: (
|
2023-07-14 23:38:01 +00:00
|
|
|
".rightside a.src",
|
2022-10-16 13:15:03 +00:00
|
|
|
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
|
|
|
|
ALL,
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
compare-elements-css: (
|
2023-07-14 23:38:01 +00:00
|
|
|
".rightside a.src",
|
|
|
|
"a.rightside.src",
|
2023-01-06 14:18:51 +00:00
|
|
|
["color", "text-decoration"],
|
|
|
|
)
|
|
|
|
compare-elements-css: (
|
2023-07-14 23:38:01 +00:00
|
|
|
".main-heading a.src",
|
|
|
|
"a.rightside.src",
|
2023-01-06 14:18:51 +00:00
|
|
|
["color", "text-decoration"],
|
|
|
|
)
|
2022-10-16 13:15:03 +00:00
|
|
|
|
2023-07-14 23:38:01 +00:00
|
|
|
move-cursor-to: ".main-heading a.src"
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: (
|
2023-07-14 23:38:01 +00:00
|
|
|
".main-heading a.src",
|
2022-10-16 13:15:03 +00:00
|
|
|
{"color": |src_link_color|, "text-decoration": "underline solid " + |src_link_color|},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
2023-07-14 23:38:01 +00:00
|
|
|
move-cursor-to: ".impl-items .rightside a.src"
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: (
|
2023-07-14 23:38:01 +00:00
|
|
|
".impl-items .rightside a.src",
|
2022-10-16 13:15:03 +00:00
|
|
|
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
2023-07-14 23:38:01 +00:00
|
|
|
move-cursor-to: ".impl-items a.rightside.src"
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: (
|
2023-07-14 23:38:01 +00:00
|
|
|
".impl-items a.rightside.src",
|
2022-10-16 13:15:03 +00:00
|
|
|
{"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-04-11 17:11:34 +00:00
|
|
|
go-to: "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-04-11 17:11:34 +00:00
|
|
|
set-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-09-20 01:08:55 +00:00
|
|
|
assert-css: (".sidebar .block a", {"color": |sidebar_link_color|})
|
2023-01-13 17:09:25 +00:00
|
|
|
assert-css: (".main-heading h1 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",
|
2023-05-21 11:09:55 +00:00
|
|
|
"main_color": "#c5c5c5",
|
|
|
|
"title_color": "#fff",
|
|
|
|
"main_heading_color": "#fff",
|
|
|
|
"main_heading_type_color": "#ffa0a5",
|
|
|
|
"src_link_color": "#39afd7",
|
|
|
|
"sidebar_link_color": "#53b1db",
|
2022-10-17 16:08:53 +00:00
|
|
|
},
|
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",
|
2023-05-21 11:09:55 +00:00
|
|
|
"main_color": "#ddd",
|
|
|
|
"title_color": "#ddd",
|
|
|
|
"main_heading_color": "#ddd",
|
|
|
|
"main_heading_type_color": "#2dbfb8",
|
|
|
|
"src_link_color": "#d2991d",
|
|
|
|
"sidebar_link_color": "#fdbf35",
|
2022-10-17 16:08:53 +00:00
|
|
|
},
|
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",
|
2023-05-21 11:09:55 +00:00
|
|
|
"main_color": "black",
|
|
|
|
"title_color": "black",
|
|
|
|
"main_heading_color": "black",
|
|
|
|
"main_heading_type_color": "#ad378a",
|
|
|
|
"src_link_color": "#3873ad",
|
|
|
|
"sidebar_link_color": "#356da4",
|
2022-10-17 16:08:53 +00:00
|
|
|
},
|
2022-08-24 18:25:12 +00:00
|
|
|
)
|