Rollup merge of #114999 - GuillaumeGomez:migrate-gui-test-color-34, r=notriddle

Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

This test needed more cleanup: first I removed duplication by using a function, then I merge similar rules which had the same values.

r? `@notriddle`
This commit is contained in:
Matthias Krüger 2023-08-20 08:34:04 +02:00 committed by GitHub
commit 4542711a69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,56 +2,60 @@
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
show-text: true show-text: true
// Ayu theme define-function: (
"check-search-colors",
(
theme, border, background, search_input_color, search_input_border_focus,
menu_button_border, menu_button_a_color, menu_button_a_border_hover, menu_a_color,
),
block {
set-local-storage: { set-local-storage: {
"rustdoc-theme": "ayu", "rustdoc-theme": |theme|,
"rustdoc-use-system-theme": "false", "rustdoc-use-system-theme": "false",
} }
reload: reload:
assert-css: ( assert-css: (
".search-input", ".search-input",
{ {
"border-color": "rgb(92, 103, 115)", "border-color": |border|,
"background-color": "rgb(20, 25, 32)", "background-color": |background|,
"color": "rgb(255, 255, 255)", "color": |search_input_color|,
}, },
) )
// Focus on search input.
focus: ".search-input" focus: ".search-input"
// Nothing should change.
assert-css: ( assert-css: (
".search-input", ".search-input",
{ {
"border-color": "rgb(92, 103, 115)", "border-color": |search_input_border_focus|,
"background-color": "rgb(20, 25, 32)", "background-color": |background|,
"color": "rgb(255, 255, 255)", "color": |search_input_color|,
}, },
) )
assert-css: ( assert-css: (
"#help-button", "#help-button",
{"border-color": "rgb(197, 197, 197)"}, {"border-color": |menu_button_border|},
) )
assert-css: ( assert-css: (
"#help-button > a", "#help-button > a",
{ {
"color": "rgb(255, 255, 255)", "color": |menu_button_a_color|,
"border-color": "rgb(92, 103, 115)", "border-color": |border|,
"background-color": "rgb(20, 25, 32)", "background-color": |background|,
}, },
) )
// Hover help button.
move-cursor-to: "#help-button" move-cursor-to: "#help-button"
assert-css: ( assert-css: (
"#help-button:hover", "#help-button:hover",
{"border-color": "rgb(197, 197, 197)"}, {"border-color": |menu_button_border|},
) )
// Only "border-color" should change.
assert-css: ( assert-css: (
"#help-button:hover > a", "#help-button > a",
{ {
"color": "rgb(255, 255, 255)", "color": |menu_button_a_color|,
"border-color": "rgb(224, 224, 224)", "border-color": |menu_button_a_border_hover|,
"background-color": "rgb(20, 25, 32)", "background-color": |background|,
}, },
) )
// Link color inside // Link color inside
@ -59,205 +63,77 @@ click: "#help-button"
assert-css: ( assert-css: (
"#help a", "#help a",
{ {
"color": "rgb(57, 175, 215)", "color": |menu_a_color|,
}, },
) )
assert-css: ( assert-css: (
"#settings-menu", "#settings-menu",
{"border-color": "rgb(197, 197, 197)"}, {"border-color": |menu_button_border|},
) )
assert-css: ( assert-css: (
"#settings-menu > a", "#settings-menu > a",
{ {
"border-color": "rgb(92, 103, 115)", "color": |menu_button_a_color|,
"background-color": "rgb(20, 25, 32)", "border-color": |border|,
"background-color": |background|,
}, },
) )
// Hover settings menu.
move-cursor-to: "#settings-menu" move-cursor-to: "#settings-menu"
assert-css: ( assert-css: (
"#settings-menu:hover", "#settings-menu:hover",
{"border-color": "rgb(197, 197, 197)"}, {"border-color": |menu_button_border|},
) )
// Only "border-color" should change.
assert-css: ( assert-css: (
"#settings-menu:hover > a", "#settings-menu:hover > a",
{ {
"border-color": "rgb(224, 224, 224)", "color": |menu_button_a_color|,
"background-color": "rgb(20, 25, 32)", "border-color": |menu_button_a_border_hover|,
"background-color": |background|,
},
)
}, },
) )
// Dark theme call-function: (
set-local-storage: { "check-search-colors",
"rustdoc-theme": "dark", {
"rustdoc-use-system-theme": "false", "theme": "ayu",
"border": "#5c6773",
"background": "#141920",
"search_input_color": "#fff",
"search_input_border_focus": "#5c6773",
"menu_button_border": "#c5c5c5",
"menu_button_a_color": "#fff",
"menu_button_a_border_hover": "#e0e0e0",
"menu_a_color": "#39afd7",
} }
reload: )
call-function: (
assert-css: ( "check-search-colors",
".search-input",
{ {
"border-color": "rgb(224, 224, 224)", "theme": "dark",
"background-color": "rgb(240, 240, 240)", "border": "#e0e0e0",
"color": "rgb(17, 17, 17)", "background": "#f0f0f0",
}, "search_input_color": "#111",
) "search_input_border_focus": "#008dfd",
focus: ".search-input" "menu_button_border": "#ddd",
// Only "border-color" should change. "menu_button_a_color": "#000",
assert-css: ( "menu_button_a_border_hover": "#ffb900",
".search-input", "menu_a_color": "#d2991d",
{
"border-color": "rgb(0, 141, 253)",
"background-color": "rgb(240, 240, 240)",
"color": "rgb(17, 17, 17)",
},
)
assert-css: (
"#help-button",
{"border-color": "rgb(221, 221, 221)"},
)
assert-css: (
"#help-button > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(240, 240, 240)",
},
)
move-cursor-to: "#help-button"
assert-css: (
"#help-button:hover",
{"border-color": "rgb(221, 221, 221)"},
)
// Only "border-color" should change.
assert-css: (
"#help-button:hover > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(255, 185, 0)",
"background-color": "rgb(240, 240, 240)",
},
)
// Link color inside
click: "#help-button"
assert-css: (
"#help a",
{
"color": "rgb(210, 153, 29)",
},
)
assert-css: (
"#settings-menu",
{"border-color": "rgb(221, 221, 221)"},
)
assert-css: (
"#settings-menu > a",
{
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(240, 240, 240)",
},
)
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": "rgb(221, 221, 221)"},
)
// Only "border-color" should change.
assert-css: (
"#settings-menu:hover > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(255, 185, 0)",
"background-color": "rgb(240, 240, 240)",
},
)
// Light theme
set-local-storage: {
"rustdoc-theme": "light",
"rustdoc-use-system-theme": "false",
} }
reload: )
call-function: (
assert-css: ( "check-search-colors",
".search-input",
{ {
"border-color": "rgb(224, 224, 224)", "theme": "light",
"background-color": "rgb(255, 255, 255)", "border": "#e0e0e0",
"color": "rgb(0, 0, 0)", "background": "#fff",
}, "search_input_color": "#000",
) "search_input_border_focus": "#66afe9",
focus: ".search-input" "menu_button_border": "#000",
// Nothing should change. "menu_button_a_color": "#000",
assert-css: ( "menu_button_a_border_hover": "#717171",
".search-input", "menu_a_color": "#3873ad",
{ }
"border-color": "rgb(102, 175, 233)",
"background-color": "rgb(255, 255, 255)",
"color": "rgb(0, 0, 0)",
},
)
assert-css: (
"#help-button",
{"border-color": "rgb(0, 0, 0)"},
)
assert-css: (
"#help-button > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(255, 255, 255)",
},
)
move-cursor-to: "#help-button"
assert-css: (
"#help-button:hover",
{"border-color": "rgb(0, 0, 0)"},
)
// Only "border-color" should change.
assert-css: (
"#help-button:hover > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(113, 113, 113)",
"background-color": "rgb(255, 255, 255)",
},
)
// Link color inside
click: "#help-button"
assert-css: (
"#help a",
{
"color": "rgb(56, 115, 173)",
},
)
assert-css: (
"#settings-menu",
{"border-color": "rgb(0, 0, 0)"},
)
assert-css: (
"#settings-menu > a",
{
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(255, 255, 255)",
},
)
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": "rgb(0, 0, 0)"},
)
// Only "border-color" should change.
assert-css: (
"#settings-menu:hover > a",
{
"color": "rgb(0, 0, 0)",
"border-color": "rgb(113, 113, 113)",
"background-color": "rgb(255, 255, 255)",
},
) )