1
Fork 0

Use function to remove code duplication for search-form-elements.goml test

This commit is contained in:
Guillaume Gomez 2023-08-19 17:19:46 +02:00
parent a1e1dba9cc
commit ba33bb4569

View file

@ -2,262 +2,155 @@
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: (
set-local-storage: { "check-search-colors",
"rustdoc-theme": "ayu", (
"rustdoc-use-system-theme": "false", theme, search_input_border, search_input_background, search_input_color,
} search_input_border_focus, menu_button_border, menu_button_a_color, menu_button_a_border,
reload: menu_button_a_background, menu_button_border_hover, menu_button_a_hover,
menu_button_a_border_hover, menu_button_a_background_hover, menu_a_color,
assert-css: ( ),
".search-input", block {
{ set-local-storage: {
"border-color": "rgb(92, 103, 115)", "rustdoc-theme": |theme|,
"background-color": "rgb(20, 25, 32)", "rustdoc-use-system-theme": "false",
"color": "rgb(255, 255, 255)", }
}, reload:
) assert-css: (
focus: ".search-input" ".search-input",
// Nothing should change. {
assert-css: ( "border-color": |search_input_border|,
".search-input", "background-color": |search_input_background|,
{ "color": |search_input_color|,
"border-color": "rgb(92, 103, 115)", },
"background-color": "rgb(20, 25, 32)", )
"color": "rgb(255, 255, 255)", // Focus on search input.
focus: ".search-input"
assert-css: (
".search-input",
{
"border-color": |search_input_border_focus|,
"background-color": |search_input_background|,
"color": |search_input_color|,
},
)
assert-css: (
"#help-button",
{"border-color": |menu_button_border|},
)
assert-css: (
"#help-button > a",
{
"color": |menu_button_a_color|,
"border-color": |menu_button_a_border|,
"background-color": |menu_button_a_background|,
},
)
// Hover help button.
move-cursor-to: "#help-button"
assert-css: (
"#help-button:hover",
{"border-color": |menu_button_border_hover|},
)
assert-css: (
"#help-button > a",
{
"color": |menu_button_a_hover|,
"border-color": |menu_button_a_border_hover|,
"background-color": |menu_button_a_background_hover|,
},
)
// Link color inside
click: "#help-button"
assert-css: (
"#help a",
{
"color": |menu_a_color|,
},
)
assert-css: (
"#settings-menu",
{"border-color": |menu_button_border|},
)
assert-css: (
"#settings-menu > a",
{
"color": |menu_button_a_color|,
"border-color": |menu_button_a_border|,
"background-color": |menu_button_a_background|,
},
)
// Hover settings menu.
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": |menu_button_border|},
)
assert-css: (
"#settings-menu:hover > a",
{
"color": |menu_button_a_hover|,
"border-color": |menu_button_a_border_hover|,
"background-color": |menu_button_a_background_hover|,
},
)
}, },
) )
assert-css: ( call-function: (
"#help-button", "check-search-colors",
{"border-color": "rgb(197, 197, 197)"},
)
assert-css: (
"#help-button > a",
{ {
"color": "rgb(255, 255, 255)", "theme": "ayu",
"border-color": "rgb(92, 103, 115)", "search_input_border": "rgb(92, 103, 115)",
"background-color": "rgb(20, 25, 32)", "search_input_background": "rgb(20, 25, 32)",
}, "search_input_color": "rgb(255, 255, 255)",
"search_input_border_focus": "rgb(92, 103, 115)",
"menu_button_border": "rgb(197, 197, 197)",
"menu_button_a_color": "rgb(255, 255, 255)",
"menu_button_a_border": "rgb(92, 103, 115)",
"menu_button_a_background": "rgb(20, 25, 32)",
"menu_button_border_hover": "rgb(197, 197, 197)",
"menu_button_a_hover": "rgb(255, 255, 255)",
"menu_button_a_border_hover": "rgb(224, 224, 224)",
"menu_button_a_background_hover": "rgb(20, 25, 32)",
"menu_a_color": "rgb(57, 175, 215)",
}
) )
move-cursor-to: "#help-button" call-function: (
assert-css: ( "check-search-colors",
"#help-button:hover",
{"border-color": "rgb(197, 197, 197)"},
)
// Only "border-color" should change.
assert-css: (
"#help-button:hover > a",
{ {
"color": "rgb(255, 255, 255)", "theme": "dark",
"border-color": "rgb(224, 224, 224)", "search_input_border": "rgb(224, 224, 224)",
"background-color": "rgb(20, 25, 32)", "search_input_background": "rgb(240, 240, 240)",
}, "search_input_color": "rgb(17, 17, 17)",
"search_input_border_focus": "rgb(0, 141, 253)",
"menu_button_border": "rgb(221, 221, 221)",
"menu_button_a_color": "rgb(0, 0, 0)",
"menu_button_a_border": "rgb(224, 224, 224)",
"menu_button_a_background": "rgb(240, 240, 240)",
"menu_button_border_hover": "rgb(221, 221, 221)",
"menu_button_a_hover": "rgb(0, 0, 0)",
"menu_button_a_border_hover": "rgb(255, 185, 0)",
"menu_button_a_background_hover": "rgb(240, 240, 240)",
"menu_a_color": "rgb(210, 153, 29)",
}
) )
// Link color inside call-function: (
click: "#help-button" "check-search-colors",
assert-css: (
"#help a",
{ {
"color": "rgb(57, 175, 215)", "theme": "light",
}, "search_input_border": "rgb(224, 224, 224)",
) "search_input_background": "rgb(255, 255, 255)",
"search_input_color": "rgb(0, 0, 0)",
assert-css: ( "search_input_border_focus": "rgb(102, 175, 233)",
"#settings-menu", "menu_button_border": "rgb(0, 0, 0)",
{"border-color": "rgb(197, 197, 197)"}, "menu_button_a_color": "rgb(0, 0, 0)",
) "menu_button_a_border": "rgb(224, 224, 224)",
assert-css: ( "menu_button_a_background": "rgb(255, 255, 255)",
"#settings-menu > a", "menu_button_border_hover": "rgb(0, 0, 0)",
{ "menu_button_a_hover": "rgb(0, 0, 0)",
"border-color": "rgb(92, 103, 115)", "menu_button_a_border_hover": "rgb(113, 113, 113)",
"background-color": "rgb(20, 25, 32)", "menu_button_a_background_hover": "rgb(255, 255, 255)",
}, "menu_a_color": "rgb(56, 115, 173)",
) }
move-cursor-to: "#settings-menu"
assert-css: (
"#settings-menu:hover",
{"border-color": "rgb(197, 197, 197)"},
)
// Only "border-color" should change.
assert-css: (
"#settings-menu:hover > a",
{
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(20, 25, 32)",
},
)
// Dark theme
set-local-storage: {
"rustdoc-theme": "dark",
"rustdoc-use-system-theme": "false",
}
reload:
assert-css: (
".search-input",
{
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(240, 240, 240)",
"color": "rgb(17, 17, 17)",
},
)
focus: ".search-input"
// Only "border-color" should change.
assert-css: (
".search-input",
{
"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:
assert-css: (
".search-input",
{
"border-color": "rgb(224, 224, 224)",
"background-color": "rgb(255, 255, 255)",
"color": "rgb(0, 0, 0)",
},
)
focus: ".search-input"
// Nothing should change.
assert-css: (
".search-input",
{
"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)",
},
) )