Use new block syntax for define-function in goml scripts

This commit is contained in:
Guillaume Gomez 2023-01-06 15:18:51 +01:00
parent f67aa04114
commit 009064f890
31 changed files with 573 additions and 591 deletions

View File

@ -3,70 +3,72 @@
define-function: (
"check-colors",
(theme, main_color, title_color, fqn_color, fqn_type_color, src_link_color, sidebar_link_color),
[
("goto", "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"),
block {
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
// This is needed to ensure that the text color is computed.
("show-text", true),
show-text: true
// Setting the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
("reload"),
reload:
("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", (
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: (
".rightside .srclink",
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
ALL,
)),
(
"compare-elements-css",
(".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"]),
),
(
"compare-elements-css",
(".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"]),
),
)
compare-elements-css: (
".rightside .srclink",
".rightside.srclink",
["color", "text-decoration"],
)
compare-elements-css: (
".main-heading .srclink",
".rightside.srclink",
["color", "text-decoration"],
)
("move-cursor-to", ".main-heading .srclink"),
("assert-css", (
move-cursor-to: ".main-heading .srclink"
assert-css: (
".main-heading .srclink",
{"color": |src_link_color|, "text-decoration": "underline solid " + |src_link_color|},
)),
("move-cursor-to", ".impl-items .rightside .srclink"),
("assert-css", (
)
move-cursor-to: ".impl-items .rightside .srclink"
assert-css: (
".impl-items .rightside .srclink",
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
)),
("move-cursor-to", ".impl-items .rightside.srclink"),
("assert-css", (
)
move-cursor-to: ".impl-items .rightside.srclink"
assert-css: (
".impl-items .rightside.srclink",
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
)),
)
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"),
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
// Since we changed page, we need to set the theme again.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
("reload"),
reload:
("assert-css", ("#top-doc-prose-title", {"color": |title_color|})),
assert-css: ("#top-doc-prose-title", {"color": |title_color|})
("assert-css", (".sidebar a", {"color": |sidebar_link_color|})),
("assert-css", ("h1.fqn a", {"color": |title_color|})),
assert-css: (".sidebar a", {"color": |sidebar_link_color|})
assert-css: ("h1.fqn a", {"color": |title_color|})
// We move the cursor over the "Implementations" title so the anchor is displayed.
("move-cursor-to", "h2#implementations"),
("assert-css", ("h2#implementations a.anchor", {"color": |main_color|})),
move-cursor-to: "h2#implementations"
assert-css: ("h2#implementations a.anchor", {"color": |main_color|})
// Same thing with the impl block title.
("move-cursor-to", "#impl-HeavilyDocumentedStruct"),
("assert-css", ("#impl-HeavilyDocumentedStruct a.anchor", {"color": |main_color|})),
move-cursor-to: "#impl-HeavilyDocumentedStruct"
assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": |main_color|})
("assert-css", ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})),
],
assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
},
)
call-function: (

View File

@ -9,14 +9,14 @@ show-text: true
define-function: (
"check-colors",
(theme, doc_code_color, doc_inline_code_color),
[
block {
// Set the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
("reload"),
("assert-css", (".docblock pre > code", {"color": |doc_code_color|}, ALL)),
("assert-css", (".docblock > p > code", {"color": |doc_inline_code_color|}, ALL)),
],
reload:
assert-css: (".docblock pre > code", {"color": |doc_code_color|}, ALL)
assert-css: (".docblock > p > code", {"color": |doc_inline_code_color|}, ALL)
},
)
call-function: ("check-colors", ("ayu", "rgb(230, 225, 207)", "rgb(255, 180, 84)"))

View File

@ -5,32 +5,32 @@ show-text: true
define-function: (
"check-colors",
(theme, background, color, border),
[
block {
// Setting the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
// compile_fail block
("assert-css", (
assert-css: (
".docblock .example-wrap.compile_fail .tooltip",
{"color": "rgba(255, 0, 0, 0.5)"},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.compile_fail",
{"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
)),
)
("move-cursor-to", ".docblock .example-wrap.compile_fail .tooltip"),
move-cursor-to: ".docblock .example-wrap.compile_fail .tooltip"
("assert-css", (
assert-css: (
".docblock .example-wrap.compile_fail .tooltip",
{"color": "rgb(255, 0, 0)"},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.compile_fail",
{"border-left": "2px solid rgb(255, 0, 0)"},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.compile_fail .tooltip::after",
{
"content": '"This example deliberately fails to compile"',
@ -39,37 +39,37 @@ define-function: (
"color": |color|,
"border": "1px solid " + |border|,
},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.compile_fail .tooltip::before",
{
"border-width": "5px",
"border-style": "solid",
"border-color": "rgba(0, 0, 0, 0) " + |background| + " rgba(0, 0, 0, 0) rgba(0, 0, 0, 0)",
},
)),
)
// should_panic block
("assert-css", (
assert-css: (
".docblock .example-wrap.should_panic .tooltip",
{"color": "rgba(255, 0, 0, 0.5)"},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.should_panic",
{"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
)),
)
("move-cursor-to", ".docblock .example-wrap.should_panic .tooltip"),
move-cursor-to: ".docblock .example-wrap.should_panic .tooltip"
("assert-css", (
assert-css: (
".docblock .example-wrap.should_panic .tooltip",
{"color": "rgb(255, 0, 0)"},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.should_panic",
{"border-left": "2px solid rgb(255, 0, 0)"},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.should_panic .tooltip::after",
{
"content": '"This example panics"',
@ -78,37 +78,37 @@ define-function: (
"color": |color|,
"border": "1px solid " + |border|,
},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.should_panic .tooltip::before",
{
"border-width": "5px",
"border-style": "solid",
"border-color": "rgba(0, 0, 0, 0) " + |background| + " rgba(0, 0, 0, 0) rgba(0, 0, 0, 0)",
},
)),
)
// ignore block
("assert-css", (
assert-css: (
".docblock .example-wrap.ignore .tooltip",
{"color": "rgba(255, 142, 0, 0.6)"},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.ignore",
{"border-left": "2px solid rgba(255, 142, 0, 0.6)"},
)),
)
("move-cursor-to", ".docblock .example-wrap.ignore .tooltip"),
move-cursor-to: ".docblock .example-wrap.ignore .tooltip"
("assert-css", (
assert-css: (
".docblock .example-wrap.ignore .tooltip",
{"color": "rgb(255, 142, 0)"},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.ignore",
{"border-left": "2px solid rgb(255, 142, 0)"},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.ignore .tooltip::after",
{
"content": '"This example is not tested"',
@ -117,16 +117,16 @@ define-function: (
"color": |color|,
"border": "1px solid " + |border|,
},
)),
("assert-css", (
)
assert-css: (
".docblock .example-wrap.ignore .tooltip::before",
{
"border-width": "5px",
"border-style": "solid",
"border-color": "rgba(0, 0, 0, 0) " + |background| + " rgba(0, 0, 0, 0) rgba(0, 0, 0, 0)",
},
)),
],
)
},
)
call-function: ("check-colors", {

View File

@ -11,19 +11,19 @@ assert-false: "pre.example-line-numbers"
define-function: (
"check-colors",
(theme, color),
[
block {
// We now set the setting to show the line numbers on code examples.
("local-storage", {
local-storage: {
"rustdoc-theme": |theme|,
"rustdoc-use-system-theme": "false",
"rustdoc-line-numbers": "true"
}),
}
// We reload to make the line numbers appear and change theme.
("reload"),
reload:
// We wait for them to be added into the DOM by the JS...
("wait-for", "pre.example-line-numbers"),
wait-for: "pre.example-line-numbers"
// If the test didn't fail, it means that it was found!
("assert-css", (
assert-css: (
"pre.example-line-numbers",
{
"color": |color|,
@ -32,8 +32,8 @@ define-function: (
"text-align": "right",
},
ALL,
)),
],
)
},
)
call-function: ("check-colors", {
"theme": "ayu",

View File

@ -7,32 +7,32 @@ compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock tab
define-function: (
"check-colors",
(theme, border_color, zebra_stripe_color),
[
("local-storage", {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}),
("reload"),
("assert-css", (".top-doc .docblock table tbody tr:nth-child(1)", {
block {
local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}
reload:
assert-css: (".top-doc .docblock table tbody tr:nth-child(1)", {
"background-color": "rgba(0, 0, 0, 0)",
})),
("assert-css", (".top-doc .docblock table tbody tr:nth-child(2)", {
})
assert-css: (".top-doc .docblock table tbody tr:nth-child(2)", {
"background-color": |zebra_stripe_color|,
})),
("assert-css", (".top-doc .docblock table tbody tr:nth-child(3)", {
})
assert-css: (".top-doc .docblock table tbody tr:nth-child(3)", {
"background-color": "rgba(0, 0, 0, 0)",
})),
("assert-css", (".top-doc .docblock table tbody tr:nth-child(4)", {
})
assert-css: (".top-doc .docblock table tbody tr:nth-child(4)", {
"background-color": |zebra_stripe_color|,
})),
("assert-css", (".top-doc .docblock table td", {
})
assert-css: (".top-doc .docblock table td", {
"border-style": "solid",
"border-width": "1px",
"border-color": |border_color|,
})),
("assert-css", (".top-doc .docblock table th", {
})
assert-css: (".top-doc .docblock table th", {
"border-style": "solid",
"border-width": "1px",
"border-color": |border_color|,
})),
]
})
}
)
call-function: ("check-colors", {

View File

@ -3,39 +3,39 @@
define-function: (
"check-colors",
(theme, color, code_header_color, focus_background_color, headings_color),
[
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"),
block {
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// This is needed so that the text color is computed.
("show-text", true),
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (
show-text: true
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: (
".impl",
{"color": |color|, "background-color": "rgba(0, 0, 0, 0)"},
ALL,
)),
("assert-css", (
)
assert-css: (
".impl .code-header",
{"color": |code_header_color|, "background-color": "rgba(0, 0, 0, 0)"},
ALL,
)),
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"),
("assert-css", (
)
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
assert-css: (
"#impl-Foo",
{"color": |color|, "background-color": |focus_background_color|},
)),
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"),
("assert-css", (
)
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
assert-css: (
"#method\.must_use",
{"color": |color|, "background-color": |focus_background_color|},
ALL,
)),
("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"),
("assert-css", (".small-section-header a", {"color": |color|}, ALL)),
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"),
)
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-css: (".small-section-header a", {"color": |color|}, ALL)
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
// We select headings (h2, h3, h...).
("assert-css", (".docblock > :not(p) > a", {"color": |headings_color|}, ALL)),
],
assert-css: (".docblock > :not(p) > a", {"color": |headings_color|}, ALL)
},
)
call-function: (

View File

@ -157,38 +157,38 @@ goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
define-function: (
"check-colors",
(theme, heading_color, small_heading_color, heading_border_color),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (
block {
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: (
".top-doc .docblock h2",
{"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
)),
("assert-css", (
)
assert-css: (
".top-doc .docblock h3",
{"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
)),
("assert-css", (
)
assert-css: (
".top-doc .docblock h4",
{"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
)),
("assert-css", (
)
assert-css: (
".top-doc .docblock h5",
{"color": |small_heading_color|, "border-bottom-width": "0px"},
)),
("assert-css", (
)
assert-css: (
"#implementations-list .docblock h4",
{"color": |heading_color|, "border-bottom-width": "0px"},
)),
("assert-css", (
)
assert-css: (
"#implementations-list .docblock h5",
{"color": |small_heading_color|, "border-bottom-width": "0px"},
)),
("assert-css", (
)
assert-css: (
"#implementations-list .docblock h6",
{"color": |small_heading_color|, "border-bottom-width": "0px"},
)),
],
)
},
)
call-function: (
"check-colors",
@ -221,11 +221,11 @@ call-function: (
define-function: (
"check-since-color",
(theme),
[
("local-storage", {"rustdoc-theme": |theme|}),
("reload"),
("assert-css", (".since", {"color": "rgb(128, 128, 128)"}, ALL)),
],
block {
local-storage: {"rustdoc-theme": |theme|}
reload:
assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
},
)
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"

View File

@ -18,17 +18,17 @@ show-text: true
define-function: (
"check-colors",
(theme, color, background, box_shadow),
[
block {
// Setting the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
("reload"),
("assert-css", ("#help kbd", {
reload:
assert-css: ("#help kbd", {
"color": |color|,
"background-color": |background|,
"box-shadow": |box_shadow| + " 0px -1px 0px 0px inset",
}, ALL)),
],
}, ALL)
},
)
call-function: ("check-colors", {

View File

@ -21,24 +21,24 @@ define-function: (
comment,
doc_comment,
),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", ("pre.rust .kw", {"color": |kw|}, ALL)),
("assert-css", ("pre.rust .kw-2", {"color": |kw2|}, ALL)),
("assert-css", ("pre.rust .prelude-ty", {"color": |prelude_ty|}, ALL)),
("assert-css", ("pre.rust .prelude-val", {"color": |prelude_val|}, ALL)),
("assert-css", ("pre.rust .lifetime", {"color": |lifetime|}, ALL)),
("assert-css", ("pre.rust .number", {"color": |number|}, ALL)),
("assert-css", ("pre.rust .string", {"color": |string|}, ALL)),
("assert-css", ("pre.rust .bool-val", {"color": |bool_val|}, ALL)),
("assert-css", ("pre.rust .self", {"color": |self|}, ALL)),
("assert-css", ("pre.rust .attr", {"color": |attr|}, ALL)),
("assert-css", ("pre.rust .macro", {"color": |macro|}, ALL)),
("assert-css", ("pre.rust .question-mark", {"color": |question_mark|}, ALL)),
("assert-css", ("pre.rust .comment", {"color": |comment|}, ALL)),
("assert-css", ("pre.rust .doccomment", {"color": |doc_comment|}, ALL)),
],
block {
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: ("pre.rust .kw", {"color": |kw|}, ALL)
assert-css: ("pre.rust .kw-2", {"color": |kw2|}, ALL)
assert-css: ("pre.rust .prelude-ty", {"color": |prelude_ty|}, ALL)
assert-css: ("pre.rust .prelude-val", {"color": |prelude_val|}, ALL)
assert-css: ("pre.rust .lifetime", {"color": |lifetime|}, ALL)
assert-css: ("pre.rust .number", {"color": |number|}, ALL)
assert-css: ("pre.rust .string", {"color": |string|}, ALL)
assert-css: ("pre.rust .bool-val", {"color": |bool_val|}, ALL)
assert-css: ("pre.rust .self", {"color": |self|}, ALL)
assert-css: ("pre.rust .attr", {"color": |attr|}, ALL)
assert-css: ("pre.rust .macro", {"color": |macro|}, ALL)
assert-css: ("pre.rust .question-mark", {"color": |question_mark|}, ALL)
assert-css: ("pre.rust .comment", {"color": |comment|}, ALL)
assert-css: ("pre.rust .doccomment", {"color": |doc_comment|}, ALL)
},
)
call-function: ("check-colors", {

View File

@ -17,22 +17,23 @@ define-function: (
fn_color,
assoc_type_color,
),
[
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html"),
("show-text", true),
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (".item-decl .code-attribute", {"color": |attr_color|}, ALL)),
("assert-css", (".item-decl .trait", {"color": |trait_color|}, ALL)),
block {
goto: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html"
show-text: true
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: (".item-decl .code-attribute", {"color": |attr_color|}, ALL)
assert-css: (".item-decl .trait", {"color": |trait_color|}, ALL)
// We need to add `code` here because otherwise it would select the parent too.
("assert-css", (".item-decl code .struct", {"color": |struct_color|}, ALL)),
("assert-css", (".item-decl .enum", {"color": |enum_color|}, ALL)),
("assert-css", (".item-decl .primitive", {"color": |primitive_color|}, ALL)),
("goto", "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html"),
("assert-css", (".item-decl .constant", {"color": |constant_color|}, ALL)),
("assert-css", (".item-decl .fn", {"color": |fn_color|}, ALL)),
("assert-css", (".item-decl .associatedtype", {"color": |assoc_type_color|}, ALL)),
],
assert-css: (".item-decl code .struct", {"color": |struct_color|}, ALL)
assert-css: (".item-decl .enum", {"color": |enum_color|}, ALL)
assert-css: (".item-decl .primitive", {"color": |primitive_color|}, ALL)
goto: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html"
assert-css: (".item-decl .constant", {"color": |constant_color|}, ALL)
assert-css: (".item-decl .fn", {"color": |fn_color|}, ALL)
assert-css: (".item-decl .associatedtype", {"color": |assoc_type_color|}, ALL)
},
)
call-function: (

View File

@ -4,17 +4,17 @@ goto: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html"
define-function: (
"check-background-color",
(theme, background_color),
[
block {
// Set the theme.
("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }),
local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }
// We reload the page so the local storage settings are being used.
("reload"),
("assert-css", (
reload:
assert-css: (
"body.source .example-wrap pre.rust a",
{"background-color": |background_color|},
ALL,
)),
],
)
},
)
call-function: ("check-background-color", ("ayu", "rgb(51, 51, 51)"))

View File

@ -8,29 +8,29 @@ define-function: (
"check-colors",
(theme, mod, macro, struct, enum, trait, fn, type, union, keyword,
sidebar, sidebar_current, sidebar_current_background),
[
("local-storage", {
block {
local-storage: {
"rustdoc-theme": |theme|,
"rustdoc-use-system-theme": "false",
}),
("reload"),
}
reload:
// Checking results colors.
("assert-css", (".item-table .mod", {"color": |mod|}, ALL)),
("assert-css", (".item-table .macro", {"color": |macro|}, ALL)),
("assert-css", (".item-table .struct", {"color": |struct|}, ALL)),
("assert-css", (".item-table .enum", {"color": |enum|}, ALL)),
("assert-css", (".item-table .trait", {"color": |trait|}, ALL)),
("assert-css", (".item-table .fn", {"color": |fn|}, ALL)),
("assert-css", (".item-table .type", {"color": |type|}, ALL)),
("assert-css", (".item-table .union", {"color": |union|}, ALL)),
("assert-css", (".item-table .keyword", {"color": |keyword|}, ALL)),
assert-css: (".item-table .mod", {"color": |mod|}, ALL)
assert-css: (".item-table .macro", {"color": |macro|}, ALL)
assert-css: (".item-table .struct", {"color": |struct|}, ALL)
assert-css: (".item-table .enum", {"color": |enum|}, ALL)
assert-css: (".item-table .trait", {"color": |trait|}, ALL)
assert-css: (".item-table .fn", {"color": |fn|}, ALL)
assert-css: (".item-table .type", {"color": |type|}, ALL)
assert-css: (".item-table .union", {"color": |union|}, ALL)
assert-css: (".item-table .keyword", {"color": |keyword|}, ALL)
// Checking sidebar elements.
("assert-css", (
assert-css: (
".sidebar-elems a:not(.current)",
{"color": |sidebar|, "background-color": "rgba(0, 0, 0, 0)", "font-weight": "400"},
ALL,
)),
("assert-css", (
)
assert-css: (
".sidebar-elems a.current",
{
"color": |sidebar_current|,
@ -38,8 +38,8 @@ define-function: (
"font-weight": "500",
},
ALL,
)),
],
)
},
)
call-function: (

View File

@ -123,40 +123,40 @@ assert-count: ("//*[@class='notable popover']", 0)
define-function: (
"check-colors",
(theme, header_color, content_color, type_color, trait_color),
[
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html"),
block {
goto: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html"
// This is needed to ensure that the text color is computed.
("show-text", true),
show-text: true
// Setting the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
("reload"),
reload:
("move-cursor-to", "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"),
("assert-count", (".notable.popover", 1)),
move-cursor-to: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
assert-count: (".notable.popover", 1)
("assert-css", (
assert-css: (
".notable.popover h3",
{"color": |header_color|},
ALL,
)),
("assert-css", (
)
assert-css: (
".notable.popover pre",
{"color": |content_color|},
ALL,
)),
("assert-css", (
)
assert-css: (
".notable.popover pre a.struct",
{"color": |type_color|},
ALL,
)),
("assert-css", (
)
assert-css: (
".notable.popover pre a.trait",
{"color": |trait_color|},
ALL,
)),
]
)
},
)
call-function: (

View File

@ -8,27 +8,27 @@ show-text: true
define-function: (
"check-run-button",
(theme, color, background, hover_color, hover_background),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (".test-arrow", {"visibility": "hidden"})),
("move-cursor-to", ".example-wrap"),
("assert-css", (".test-arrow", {
block {
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: (".test-arrow", {"visibility": "hidden"})
move-cursor-to: ".example-wrap"
assert-css: (".test-arrow", {
"visibility": "visible",
"color": |color|,
"background-color": |background|,
"font-size": "22px",
"border-radius": "5px",
})),
("move-cursor-to", ".test-arrow"),
("assert-css", (".test-arrow:hover", {
})
move-cursor-to: ".test-arrow"
assert-css: (".test-arrow:hover", {
"visibility": "visible",
"color": |hover_color|,
"background-color": |hover_background|,
"font-size": "22px",
"border-radius": "5px",
})),
],
})
},
)
call-function: ("check-run-button", {

View File

@ -4,29 +4,29 @@ goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
define-function: (
"check-logo",
(theme, filter),
[
block {
// Going to the doc page.
("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"),
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
// Changing theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (".rust-logo", {"filter": |filter|})),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: (".rust-logo", {"filter": |filter|})
// Going to the source code page.
("goto", "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"),
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
// Changing theme (since it's local files, the local storage works by folder).
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (".rust-logo", {"filter": |filter|})),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: (".rust-logo", {"filter": |filter|})
// Now we check that the non-rust logos don't have a CSS filter set.
("goto", "file://" + |DOC_PATH| + "/huge_logo/index.html"),
goto: "file://" + |DOC_PATH| + "/huge_logo/index.html"
// Changing theme on the new page (again...).
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
// Check there is no rust logo
("assert-false", ".rust-logo"),
assert-false: ".rust-logo"
// Check there is no filter.
("assert-css", (".sidebar .logo-container img", {"filter": "none"})),
],
assert-css: (".sidebar .logo-container img", {"filter": "none"})
},
)
call-function: (

View File

@ -6,29 +6,29 @@ define-function: (
"check-colors",
(theme, highlight, highlight_focus, help_border, help_color, help_hover_border,
help_hover_color),
[
("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }),
("reload"),
("wait-for", ".more-examples-toggle"),
("assert-css", (".scraped-example .example-wrap .rust span.highlight:not(.focus)", {
block {
local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }
reload:
wait-for: ".more-examples-toggle"
assert-css: (".scraped-example .example-wrap .rust span.highlight:not(.focus)", {
"background-color": |highlight|,
}, ALL)),
("assert-css", (".scraped-example .example-wrap .rust span.highlight.focus", {
}, ALL)
assert-css: (".scraped-example .example-wrap .rust span.highlight.focus", {
"background-color": |highlight_focus|,
}, ALL)),
}, ALL)
("assert-css", (".scraped-example-list .scrape-help", {
assert-css: (".scraped-example-list .scrape-help", {
"border-color": |help_border|,
"color": |help_color|,
})),
("move-cursor-to", ".scraped-example-list .scrape-help"),
("assert-css", (".scraped-example-list .scrape-help:hover", {
})
move-cursor-to: ".scraped-example-list .scrape-help"
assert-css: (".scraped-example-list .scrape-help:hover", {
"border-color": |help_hover_border|,
"color": |help_hover_color|,
})),
})
// Moving the cursor to another item to not break next runs.
("move-cursor-to", ".search-input"),
]
move-cursor-to: ".search-input"
}
)
call-function: ("check-colors", {

View File

@ -6,24 +6,24 @@ show-text: true
define-function: (
"check-color",
(theme, toggle_line_color, toggle_line_hover_color),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
block {
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
// Clicking "More examples..." will open additional examples
("assert-attribute-false", (".more-examples-toggle", {"open": ""})),
("click", ".more-examples-toggle"),
("assert-attribute", (".more-examples-toggle", {"open": ""})),
assert-attribute-false: (".more-examples-toggle", {"open": ""})
click: ".more-examples-toggle"
assert-attribute: (".more-examples-toggle", {"open": ""})
("assert-css", (".toggle-line-inner", {"background-color": |toggle_line_color|}, ALL)),
("move-cursor-to", ".toggle-line"),
("assert-css", (
assert-css: (".toggle-line-inner", {"background-color": |toggle_line_color|}, ALL)
move-cursor-to: ".toggle-line"
assert-css: (
".toggle-line:hover .toggle-line-inner",
{"background-color": |toggle_line_hover_color|},
)),
)
// Moving cursor away from the toggle line to prevent disrupting next test.
("move-cursor-to", ".search-input"),
],
move-cursor-to: ".search-input"
},
)
call-function: ("check-color", {

View File

@ -5,18 +5,18 @@ show-text: true
define-function: (
"check-no-result",
(theme, link, link_hover),
[
block {
// Changing theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("wait-for", "#results"),
("assert", ".search-failed.active"),
("assert-css", ("#results a", {"color": |link|}, ALL)),
("move-cursor-to", "#results a"),
("assert-css", ("#results a:hover", {"color": |link_hover|})),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
wait-for: "#results"
assert: ".search-failed.active"
assert-css: ("#results a", {"color": |link|}, ALL)
move-cursor-to: "#results a"
assert-css: ("#results a:hover", {"color": |link_hover|})
// Moving the cursor to some other place to not create issues with next function run.
("move-cursor-to", ".search-input"),
]
move-cursor-to: ".search-input"
},
)
call-function: ("check-no-result", {

View File

@ -3,53 +3,32 @@
define-function: (
"check-result-color",
(result_kind, color, hover_color),
[
(
"assert-css",
(".result-" + |result_kind| + " ." + |result_kind|, {"color": |color|}, ALL),
),
(
"assert-css",
(
".result-" + |result_kind|,
{"color": |entry_color|, "background-color": |background_color|},
),
),
(
"move-cursor-to",
block {
assert-css: (".result-" + |result_kind| + " ." + |result_kind|, {"color": |color|}, ALL)
assert-css: (
".result-" + |result_kind|,
),
(
"assert-css",
(
".result-" + |result_kind| + ":hover",
{"color": |hover_entry_color|, "background-color": |hover_background_color|},
),
),
(
"assert-css",
(".result-" + |result_kind| + ":hover ." + |result_kind|, {"color": |hover_color|}),
),
(
"move-cursor-to",
".search-input",
),
(
"focus",
".result-" + |result_kind|,
),
(
"assert-css",
(
".result-" + |result_kind| + ":focus",
{"color": |hover_entry_color|, "background-color": |hover_background_color|},
),
),
(
"assert-css",
(".result-" + |result_kind| + ":focus ." + |result_kind|, {"color": |hover_color|}),
),
],
{"color": |entry_color|, "background-color": |background_color|},
)
move-cursor-to: ".result-" + |result_kind|
assert-css: (
".result-" + |result_kind| + ":hover",
{"color": |hover_entry_color|, "background-color": |hover_background_color|},
)
assert-css: (
".result-" + |result_kind| + ":hover ." + |result_kind|,
{"color": |hover_color|},
)
move-cursor-to: ".search-input"
focus: ".result-" + |result_kind|
assert-css: (
".result-" + |result_kind| + ":focus",
{"color": |hover_entry_color|, "background-color": |hover_background_color|},
)
assert-css: (
".result-" + |result_kind| + ":focus ." + |result_kind|,
{"color": |hover_color|},
)
},
)
goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=coo"
@ -389,20 +368,20 @@ show-text: true
define-function: (
"check-alias",
(theme, alias, grey),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("write", (".search-input", "thisisanalias")),
block {
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
write: (".search-input", "thisisanalias")
// To be SURE that the search will be run.
("press-key", 'Enter'),
press-key: 'Enter'
// Waiting for the search results to appear...
("wait-for", "#search-tabs"),
wait-for: "#search-tabs"
// Checking that the colors for the alias element are the ones expected.
("assert-css", (".result-name > .alias", {"color": |alias|})),
("assert-css", (".result-name > .alias > .grey", {"color": |grey|})),
assert-css: (".result-name > .alias", {"color": |alias|})
assert-css: (".result-name > .alias > .grey", {"color": |grey|})
// Leave the search results to prevent reloading with an already filled search input.
("press-key", "Escape"),
],
press-key: "Escape"
},
)
call-function: ("check-alias", {

View File

@ -42,17 +42,17 @@ show-text: true
define-function: (
"check-filter",
(theme, border, filter, hover_border, hover_filter),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("wait-for", "#crate-search"),
("assert-css", ("#crate-search", {"border": "1px solid " + |border|})),
("assert-css", ("#crate-search-div::after", {"filter": |filter|})),
("move-cursor-to", "#crate-search"),
("assert-css", ("#crate-search", {"border": "1px solid " + |hover_border|})),
("assert-css", ("#crate-search-div::after", {"filter": |hover_filter|})),
("move-cursor-to", ".search-input"),
],
block {
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
wait-for: "#crate-search"
assert-css: ("#crate-search", {"border": "1px solid " + |border|})
assert-css: ("#crate-search-div::after", {"filter": |filter|})
move-cursor-to: "#crate-search"
assert-css: ("#crate-search", {"border": "1px solid " + |hover_border|})
assert-css: ("#crate-search-div::after", {"filter": |hover_filter|})
move-cursor-to: ".search-input"
},
)
call-function: ("check-filter", {

View File

@ -7,35 +7,35 @@ define-function: (
(theme, background, background_selected, background_hover, border_bottom,
border_bottom_selected, border_bottom_hover, border_top, border_top_selected,
border_top_hover),
[
block {
// Setting the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
// These two commands are used to be sure the search will be run.
("focus", ".search-input"),
("press-key", "Enter"),
focus: ".search-input"
press-key: "Enter"
("wait-for", "#search-tabs"),
("assert-css", ("#search-tabs > button:not(.selected)", {
wait-for: "#search-tabs"
assert-css: ("#search-tabs > button:not(.selected)", {
"background-color": |background|,
"border-bottom": |border_bottom|,
"border-top": |border_top|,
})),
("assert-css", ("#search-tabs > button.selected", {
})
assert-css: ("#search-tabs > button.selected", {
"background-color": |background_selected|,
"border-bottom": |border_bottom_selected|,
"border-top": |border_top_selected|,
})),
("move-cursor-to", "#search-tabs > button:not(.selected)"),
("assert-css", ("#search-tabs > button:not(.selected):hover", {
})
move-cursor-to: "#search-tabs > button:not(.selected)"
assert-css: ("#search-tabs > button:not(.selected):hover", {
"background-color": |background_hover|,
"border-bottom": |border_bottom_hover|,
"border-top": |border_top_hover|,
})),
})
// To prevent disrupting next run of this function.
("move-cursor-to", ".search-input"),
],
move-cursor-to: ".search-input"
},
)
call-function: ("check-colors", {

View File

@ -12,80 +12,80 @@ define-function: (
trait_hover_background, fn, fn_hover, fn_hover_background, type, type_hover,
type_hover_background, keyword, keyword_hover, keyword_hover_background,
),
[
("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }),
("reload"),
block {
local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }
reload:
// Struct
("assert-css", (
assert-css: (
".sidebar .block.struct a:not(.current)",
{"color": |struct|, "background-color": "rgba(0, 0, 0, 0)"},
)),
("move-cursor-to", ".sidebar .block.struct a:not(.current)"),
("assert-css", (
)
move-cursor-to: ".sidebar .block.struct a:not(.current)"
assert-css: (
".sidebar .block.struct a:hover",
{"color": |struct_hover|, "background-color": |struct_hover_background|},
)),
)
// Enum
("assert-css", (
assert-css: (
".sidebar .block.enum a",
{"color": |enum|, "background-color": "rgba(0, 0, 0, 0)"},
)),
("move-cursor-to", ".sidebar .block.enum a"),
("assert-css", (
)
move-cursor-to: ".sidebar .block.enum a"
assert-css: (
".sidebar .block.enum a:hover",
{"color": |enum_hover|, "background-color": |enum_hover_background|},
)),
)
// Union
("assert-css", (
assert-css: (
".sidebar .block.union a",
{"color": |union|, "background-color": "rgba(0, 0, 0, 0)"},
)),
("move-cursor-to", ".sidebar .block.union a"),
("assert-css", (
)
move-cursor-to: ".sidebar .block.union a"
assert-css: (
".sidebar .block.union a:hover",
{"color": |union_hover|, "background-color": |union_hover_background|},
)),
)
// Trait
("assert-css", (
assert-css: (
".sidebar .block.trait a",
{"color": |trait|, "background-color": "rgba(0, 0, 0, 0)"},
)),
("move-cursor-to", ".sidebar .block.trait a"),
("assert-css", (
)
move-cursor-to: ".sidebar .block.trait a"
assert-css: (
".sidebar .block.trait a:hover",
{"color": |trait_hover|, "background-color": |trait_hover_background|},
)),
)
// Function
("assert-css", (
assert-css: (
".sidebar .block.fn a",
{"color": |fn|, "background-color": "rgba(0, 0, 0, 0)"},
)),
("move-cursor-to", ".sidebar .block.fn a"),
("assert-css", (
)
move-cursor-to: ".sidebar .block.fn a"
assert-css: (
".sidebar .block.fn a:hover",
{"color": |fn_hover|, "background-color": |fn_hover_background|},
)),
)
// Type definition
("assert-css", (
assert-css: (
".sidebar .block.type a",
{"color": |type|, "background-color": "rgba(0, 0, 0, 0)"},
)),
("move-cursor-to", ".sidebar .block.type a"),
("assert-css", (
)
move-cursor-to: ".sidebar .block.type a"
assert-css: (
".sidebar .block.type a:hover",
{"color": |type_hover|, "background-color": |type_hover_background|},
)),
)
// Keyword
("assert-css", (
assert-css: (
".sidebar .block.keyword a",
{"color": |keyword|, "background-color": "rgba(0, 0, 0, 0)"},
)),
("move-cursor-to", ".sidebar .block.keyword a"),
("assert-css", (
)
move-cursor-to: ".sidebar .block.keyword a"
assert-css: (
".sidebar .block.keyword a:hover",
{"color": |keyword_hover|, "background-color": |keyword_hover_background|},
)),
]
)
}
)
call-function: (

View File

@ -58,17 +58,17 @@ show-text: true
define-function: (
"check-colors",
(theme, color, background),
[
("local-storage", {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}),
("reload"),
block {
local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}
reload:
// Open the sidebar menu.
("click", ".sidebar-menu-toggle"),
("assert-css", (".sidebar", {
click: ".sidebar-menu-toggle"
assert-css: (".sidebar", {
"background-color": |background|,
"color": |color|,
})),
],
})
},
)
call-function: ("check-colors", {

View File

@ -35,88 +35,88 @@ define-function: (
theme, color, color_hover, background, background_hover, background_toggle,
background_toggle_hover,
),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("wait-for-css", ("#src-sidebar-toggle", {"visibility": "visible"})),
("assert-css", (
block {
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
wait-for-css: ("#src-sidebar-toggle", {"visibility": "visible"})
assert-css: (
"#source-sidebar details[open] > .files a.selected",
{"color": |color_hover|, "background-color": |background|},
)),
)
// Without hover or focus.
("assert-css", ("#src-sidebar-toggle > button", {"background-color": |background_toggle|})),
assert-css: ("#src-sidebar-toggle > button", {"background-color": |background_toggle|})
// With focus.
("focus", "#src-sidebar-toggle > button"),
("assert-css", (
focus: "#src-sidebar-toggle > button"
assert-css: (
"#src-sidebar-toggle > button:focus",
{"background-color": |background_toggle_hover|},
)),
("focus", ".search-input"),
)
focus: ".search-input"
// With hover.
("move-cursor-to", "#src-sidebar-toggle > button"),
("assert-css", (
move-cursor-to: "#src-sidebar-toggle > button"
assert-css: (
"#src-sidebar-toggle > button:hover",
{"background-color": |background_toggle_hover|},
)),
)
// Without hover or focus.
("assert-css", (
assert-css: (
"#source-sidebar details[open] > .files a:not(.selected)",
{"color": |color|, "background-color": |background_toggle|},
)),
)
// With focus.
("focus", "#source-sidebar details[open] > .files a:not(.selected)"),
("wait-for-css", (
focus: "#source-sidebar details[open] > .files a:not(.selected)"
wait-for-css: (
"#source-sidebar details[open] > .files a:not(.selected):focus",
{"color": |color_hover|, "background-color": |background_hover|},
)),
("focus", ".search-input"),
)
focus: ".search-input"
// With hover.
("move-cursor-to", "#source-sidebar details[open] > .files a:not(.selected)"),
("assert-css", (
move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)"
assert-css: (
"#source-sidebar details[open] > .files a:not(.selected):hover",
{"color": |color_hover|, "background-color": |background_hover|},
)),
)
// Without hover or focus.
("assert-css", (
assert-css: (
"#source-sidebar .dir-entry summary",
{"color": |color|, "background-color": |background_toggle|},
)),
)
// With focus.
("focus", "#source-sidebar .dir-entry summary"),
("wait-for-css", (
focus: "#source-sidebar .dir-entry summary"
wait-for-css: (
"#source-sidebar .dir-entry summary:focus",
{"color": |color_hover|, "background-color": |background_hover|},
)),
("focus", ".search-input"),
)
focus: ".search-input"
// With hover.
("move-cursor-to", "#source-sidebar .dir-entry summary"),
("assert-css", (
move-cursor-to: "#source-sidebar .dir-entry summary"
assert-css: (
"#source-sidebar .dir-entry summary:hover",
{"color": |color_hover|, "background-color": |background_hover|},
)),
)
// Without hover or focus.
("assert-css", (
assert-css: (
"#source-sidebar details[open] > .folders > details > summary",
{"color": |color|, "background-color": |background_toggle|},
)),
)
// With focus.
("focus", "#source-sidebar details[open] > .folders > details > summary"),
("wait-for-css", (
focus: "#source-sidebar details[open] > .folders > details > summary"
wait-for-css: (
"#source-sidebar details[open] > .folders > details > summary:focus",
{"color": |color_hover|, "background-color": |background_hover|},
)),
("focus", ".search-input"),
)
focus: ".search-input"
// With hover.
("move-cursor-to", "#source-sidebar details[open] > .folders > details > summary"),
("assert-css", (
move-cursor-to: "#source-sidebar details[open] > .folders > details > summary"
assert-css: (
"#source-sidebar details[open] > .folders > details > summary:hover",
{"color": |color_hover|, "background-color": |background_hover|},
)),
],
)
},
)
call-function: ("check-colors", {

View File

@ -7,43 +7,43 @@ show-text: true
define-function: (
"check-colors",
(theme, color, background_color),
[
("local-storage", {
block {
local-storage: {
"rustdoc-theme": |theme|,
"rustdoc-use-system-theme": "false",
}),
("reload"),
}
reload:
// Checking results colors.
("assert-css", (".source .sidebar", {
"color": |color|,
"background-color": |background_color|
}, ALL)),
],
assert-css: (".source .sidebar", {
"color": |color|,
"background-color": |background_color|
}, ALL)
},
)
call-function: (
"check-colors",
{
"theme": "ayu",
"color": "rgb(197, 197, 197)",
"background_color": "rgb(20, 25, 31)",
}
"check-colors",
{
"theme": "ayu",
"color": "rgb(197, 197, 197)",
"background_color": "rgb(20, 25, 31)",
}
)
call-function: (
"check-colors",
{
"theme": "dark",
"color": "rgb(221, 221, 221)",
"background_color": "rgb(80, 80, 80)",
}
"check-colors",
{
"theme": "dark",
"color": "rgb(221, 221, 221)",
"background_color": "rgb(80, 80, 80)",
}
)
call-function: (
"check-colors",
{
"theme": "light",
"color": "rgb(0, 0, 0)",
"background_color": "rgb(245, 245, 245)",
}
"check-colors",
{
"theme": "light",
"color": "rgb(0, 0, 0)",
"background_color": "rgb(245, 245, 245)",
}
)
// Next, desktop mode layout.

View File

@ -7,43 +7,43 @@ show-text: true
define-function: (
"check-colors",
(theme, color, background_color),
[
("local-storage", {
block {
local-storage: {
"rustdoc-theme": |theme|,
"rustdoc-use-system-theme": "false",
}),
("reload"),
}
reload:
// Checking results colors.
("assert-css", (".sidebar", {
"color": |color|,
"background-color": |background_color|
}, ALL)),
],
assert-css: (".sidebar", {
"color": |color|,
"background-color": |background_color|
}, ALL)
},
)
call-function: (
"check-colors",
{
"theme": "ayu",
"color": "rgb(197, 197, 197)",
"background_color": "rgb(20, 25, 31)",
}
"check-colors",
{
"theme": "ayu",
"color": "rgb(197, 197, 197)",
"background_color": "rgb(20, 25, 31)",
}
)
call-function: (
"check-colors",
{
"theme": "dark",
"color": "rgb(221, 221, 221)",
"background_color": "rgb(80, 80, 80)",
}
"check-colors",
{
"theme": "dark",
"color": "rgb(221, 221, 221)",
"background_color": "rgb(80, 80, 80)",
}
)
call-function: (
"check-colors",
{
"theme": "light",
"color": "rgb(0, 0, 0)",
"background_color": "rgb(245, 245, 245)",
}
"check-colors",
{
"theme": "light",
"color": "rgb(0, 0, 0)",
"background_color": "rgb(245, 245, 245)",
}
)
local-storage: {"rustdoc-theme": "light"}

View File

@ -22,20 +22,20 @@ assert-attribute-false: (".src-line-numbers > a:nth-child(7)", {"class": "line-h
define-function: (
"check-colors",
(theme, color, background_color, highlight_color, highlight_background_color),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (
block {
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: (
".src-line-numbers > a:not(.line-highlighted)",
{"color": |color|, "background-color": |background_color|},
ALL,
)),
("assert-css", (
)
assert-css: (
".src-line-numbers > a.line-highlighted",
{"color": |highlight_color|, "background-color": |highlight_background_color|},
ALL,
)),
],
)
},
)
call-function: ("check-colors", {
@ -124,28 +124,28 @@ store-property: (
define-function: (
"check-sidebar-dir-entry",
(x, y),
[
("assert", "details:first-of-type.dir-entry[open] > summary::marker"),
("assert-css", ("#source-sidebar > details:first-of-type.dir-entry", {"padding-left": "4px"})),
block {
assert: "details:first-of-type.dir-entry[open] > summary::marker"
assert-css: ("#source-sidebar > details:first-of-type.dir-entry", {"padding-left": "4px"})
// This check ensures that the summary is only one line.
("assert-property", (
assert-property: (
"#source-sidebar > details:first-of-type.dir-entry[open] > summary",
{"offsetHeight": |link_height|}
)),
("assert-position", (
)
assert-position: (
"#source-sidebar > details:first-of-type.dir-entry[open] > summary",
{"x": |x|, "y": |y|}
)),
("assert-property", (
)
assert-property: (
"#source-sidebar > details:first-of-type.dir-entry[open] > .files > a",
{"offsetHeight": |link_height|}
)),
("assert-position", (
)
assert-position: (
"#source-sidebar > details:first-of-type.dir-entry[open] > .files > a",
// left margin
{"x": |x| + 27, "y": |y| + |link_height|}
)),
]
)
}
)
store-property: (
source_sidebar_title_height,

View File

@ -2,40 +2,40 @@
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
show-text: true
define-function: (
"check-badge",
(theme, background, color),
[
("local-storage", {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}),
("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"),
("assert", (".docblock .stab")),
("assert", (".item-table .stab")),
("assert-css", (".stab", {
"border-radius": "3px",
"color": |color|,
"background-color": |background|,
})),
("goto", "file://" + |DOC_PATH| + "/test_docs/fn.replaced_function.html"),
("assert", (".item-info .stab")),
("assert-css", (".stab", {
"border-radius": "3px",
"color": |color|,
"background-color": |background|,
})),
]
"check-badge",
(theme, background, color),
block {
local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert: ".docblock .stab"
assert: ".item-table .stab"
assert-css: (".stab", {
"border-radius": "3px",
"color": |color|,
"background-color": |background|,
})
goto: "file://" + |DOC_PATH| + "/test_docs/fn.replaced_function.html"
assert: (".item-info .stab")
assert-css: (".stab", {
"border-radius": "3px",
"color": |color|,
"background-color": |background|,
})
},
)
call-function: ("check-badge", {
"theme": "ayu",
"color": "rgb(197, 197, 197)",
"background": "rgb(49, 69, 89)",
"theme": "ayu",
"color": "rgb(197, 197, 197)",
"background": "rgb(49, 69, 89)",
})
call-function: ("check-badge", {
"theme": "dark",
"color": "rgb(221, 221, 221)",
"background": "rgb(49, 69, 89)",
"theme": "dark",
"color": "rgb(221, 221, 221)",
"background": "rgb(49, 69, 89)",
})
call-function: ("check-badge", {
"theme": "light",
"color": "rgb(0, 0, 0)",
"background": "rgb(255, 245, 214)",
"theme": "light",
"color": "rgb(0, 0, 0)",
"background": "rgb(255, 245, 214)",
})

View File

@ -8,14 +8,14 @@ assert: "#method\.a_method:target"
define-function: (
"check-style",
(theme, background, border),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", ("#method\.a_method:target", {
block {
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: ("#method\.a_method:target", {
"background-color": |background|,
"border-right": "3px solid " + |border|,
})),
],
})
},
)
call-function: ("check-style", {

View File

@ -50,24 +50,24 @@ show-text: true
define-function: (
"check-color",
(theme, filter),
[
block {
// Setting the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
("reload"),
reload:
("assert-css", ("details.rustdoc-toggle > summary::before", {
assert-css: ("details.rustdoc-toggle > summary::before", {
"opacity": "0.5",
"filter": |filter|,
}, ALL)),
("move-cursor-to", "details.rustdoc-toggle summary"),
("assert-css", ("details.rustdoc-toggle > summary:hover::before", {
}, ALL)
move-cursor-to: "details.rustdoc-toggle summary"
assert-css: ("details.rustdoc-toggle > summary:hover::before", {
"opacity": "1",
"filter": |filter|,
})),
})
// moving the cursor somewhere else to not mess with next function calls.
("move-cursor-to", ".search-input"),
]
move-cursor-to: ".search-input"
},
)
call-function: ("check-color", {"theme": "ayu", "filter": "invert(1)"})

View File

@ -14,13 +14,13 @@ define-function: (
// `theme` is the theme being tested.
// `color` is the expected color of the `<sup>` element.
(theme, color),
[
block {
// Set the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
("reload"),
("assert-css", (".item-left sup", {"color": |color|})),
],
reload:
assert-css: (".item-left sup", {"color": |color|})
},
)
call-function: ("sup-check", ("dark", "rgb(221, 221, 221)"))