2022-12-26 06:09:40 -06:00
|
|
|
|
// Checking the colors of the search tab headers.
|
2023-09-19 21:40:36 -05:00
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=foo"
|
2022-12-26 06:09:40 -06:00
|
|
|
|
show-text: true
|
|
|
|
|
|
|
|
|
|
define-function: (
|
|
|
|
|
"check-colors",
|
2024-04-01 14:11:22 -05:00
|
|
|
|
[theme, background, background_selected, background_hover, border_bottom,
|
2022-12-26 06:09:40 -06:00
|
|
|
|
border_bottom_selected, border_bottom_hover, border_top, border_top_selected,
|
2024-04-01 14:11:22 -05:00
|
|
|
|
border_top_hover],
|
2023-01-06 08:18:51 -06:00
|
|
|
|
block {
|
2022-12-26 06:09:40 -06:00
|
|
|
|
// Setting the theme.
|
2023-04-11 12:11:34 -05:00
|
|
|
|
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
|
2023-01-06 08:18:51 -06:00
|
|
|
|
reload:
|
2022-12-26 06:09:40 -06:00
|
|
|
|
|
|
|
|
|
// These two commands are used to be sure the search will be run.
|
2023-01-06 08:18:51 -06:00
|
|
|
|
focus: ".search-input"
|
|
|
|
|
press-key: "Enter"
|
2022-12-26 06:09:40 -06:00
|
|
|
|
|
2023-01-06 08:18:51 -06:00
|
|
|
|
wait-for: "#search-tabs"
|
|
|
|
|
assert-css: ("#search-tabs > button:not(.selected)", {
|
2022-12-26 06:09:40 -06:00
|
|
|
|
"background-color": |background|,
|
|
|
|
|
"border-bottom": |border_bottom|,
|
|
|
|
|
"border-top": |border_top|,
|
2023-01-06 08:18:51 -06:00
|
|
|
|
})
|
|
|
|
|
assert-css: ("#search-tabs > button.selected", {
|
2022-12-26 06:09:40 -06:00
|
|
|
|
"background-color": |background_selected|,
|
|
|
|
|
"border-bottom": |border_bottom_selected|,
|
|
|
|
|
"border-top": |border_top_selected|,
|
2023-01-06 08:18:51 -06:00
|
|
|
|
})
|
|
|
|
|
move-cursor-to: "#search-tabs > button:not(.selected)"
|
|
|
|
|
assert-css: ("#search-tabs > button:not(.selected):hover", {
|
2022-12-26 06:09:40 -06:00
|
|
|
|
"background-color": |background_hover|,
|
|
|
|
|
"border-bottom": |border_bottom_hover|,
|
|
|
|
|
"border-top": |border_top_hover|,
|
2023-01-06 08:18:51 -06:00
|
|
|
|
})
|
2022-12-26 06:09:40 -06:00
|
|
|
|
// To prevent disrupting next run of this function.
|
2023-01-06 08:18:51 -06:00
|
|
|
|
move-cursor-to: ".search-input"
|
|
|
|
|
},
|
2022-12-26 06:09:40 -06:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
call-function: ("check-colors", {
|
|
|
|
|
"theme": "ayu",
|
2023-08-13 04:40:23 -05:00
|
|
|
|
"background": "transparent",
|
|
|
|
|
"background_selected": "#141920",
|
|
|
|
|
"background_hover": "transparent",
|
|
|
|
|
"border_bottom": "0px none #c5c5c5",
|
|
|
|
|
"border_bottom_selected": "1px solid #ffb44c",
|
2022-12-26 06:09:40 -06:00
|
|
|
|
"border_bottom_hover": "1px solid rgba(242, 151, 24, 0.3)",
|
2023-08-13 04:40:23 -05:00
|
|
|
|
"border_top": "0px none #c5c5c5",
|
|
|
|
|
"border_top_selected": "0px none #c5c5c5",
|
|
|
|
|
"border_top_hover": "0px none #c5c5c5",
|
2022-12-26 06:09:40 -06:00
|
|
|
|
})
|
|
|
|
|
call-function: ("check-colors", {
|
|
|
|
|
"theme": "dark",
|
2023-08-13 04:40:23 -05:00
|
|
|
|
"background": "#252525",
|
|
|
|
|
"background_selected": "#353535",
|
|
|
|
|
"background_hover": "#353535",
|
|
|
|
|
"border_bottom": "0px none #ddd",
|
|
|
|
|
"border_bottom_selected": "0px none #ddd",
|
|
|
|
|
"border_bottom_hover": "0px none #ddd",
|
|
|
|
|
"border_top": "2px solid #252525",
|
|
|
|
|
"border_top_selected": "2px solid #0089ff",
|
|
|
|
|
"border_top_hover": "2px solid #0089ff",
|
2022-12-26 06:09:40 -06:00
|
|
|
|
})
|
|
|
|
|
call-function: ("check-colors", {
|
|
|
|
|
"theme": "light",
|
2023-08-13 04:40:23 -05:00
|
|
|
|
"background": "#e6e6e6",
|
|
|
|
|
"background_selected": "#fff",
|
|
|
|
|
"background_hover": "#fff",
|
|
|
|
|
"border_bottom": "0px none #000",
|
|
|
|
|
"border_bottom_selected": "0px none #000",
|
|
|
|
|
"border_bottom_hover": "0px none #000",
|
|
|
|
|
"border_top": "2px solid #e6e6e6",
|
|
|
|
|
"border_top_selected": "2px solid #0089ff",
|
|
|
|
|
"border_top_hover": "2px solid #0089ff",
|
2022-12-26 06:09:40 -06:00
|
|
|
|
})
|
2023-09-19 21:40:36 -05:00
|
|
|
|
|
|
|
|
|
// set size wide enough that the text is in a single row
|
|
|
|
|
set-window-size: (851, 600)
|
|
|
|
|
|
|
|
|
|
// Check the size and count in tabs
|
2023-11-02 12:01:28 -05:00
|
|
|
|
assert-text: ("#search-tabs > button:nth-child(1) > .count", " (25) ")
|
2023-09-22 19:27:06 -05:00
|
|
|
|
assert-text: ("#search-tabs > button:nth-child(2) > .count", " (6) ")
|
2023-09-19 21:40:36 -05:00
|
|
|
|
assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0) ")
|
|
|
|
|
store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})
|
|
|
|
|
assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|})
|
|
|
|
|
assert-property: ("#search-tabs > button:nth-child(3)", {"offsetWidth": |buttonWidth|})
|
|
|
|
|
store-property: ("#search-tabs > button:nth-child(1) > .count", {"offsetWidth": countWidth})
|
|
|
|
|
assert-property: ("#search-tabs > button:nth-child(2) > .count", {"offsetWidth": |countWidth|})
|
|
|
|
|
assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": |countWidth|})
|
|
|
|
|
|
|
|
|
|
// Check that counts are in a row with each other
|
|
|
|
|
compare-elements-position: (
|
|
|
|
|
"#search-tabs > button:nth-child(1) > .count",
|
|
|
|
|
"#search-tabs > button:nth-child(2) > .count",
|
2024-04-01 14:11:22 -05:00
|
|
|
|
["y"]
|
2023-09-19 21:40:36 -05:00
|
|
|
|
)
|
|
|
|
|
compare-elements-position: (
|
|
|
|
|
"#search-tabs > button:nth-child(2) > .count",
|
|
|
|
|
"#search-tabs > button:nth-child(3) > .count",
|
2024-04-01 14:11:22 -05:00
|
|
|
|
["y"]
|
2023-09-19 21:40:36 -05:00
|
|
|
|
)
|
|
|
|
|
// Check that counts are beside the titles and haven't wrapped
|
|
|
|
|
compare-elements-position-near: (
|
|
|
|
|
"#search-tabs > button:nth-child(1)",
|
|
|
|
|
"#search-tabs > button:nth-child(1) > .count",
|
|
|
|
|
{"y": 8}
|
|
|
|
|
)
|
|
|
|
|
compare-elements-position-near: (
|
|
|
|
|
"#search-tabs > button:nth-child(2)",
|
|
|
|
|
"#search-tabs > button:nth-child(2) > .count",
|
|
|
|
|
{"y": 8}
|
|
|
|
|
)
|
|
|
|
|
compare-elements-position-near: (
|
|
|
|
|
"#search-tabs > button:nth-child(2)",
|
|
|
|
|
"#search-tabs > button:nth-child(2) > .count",
|
|
|
|
|
{"y": 8}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Set size narrow enough that they wrap.
|
|
|
|
|
// When I tested it, it wrapped at 811px, but I added some fudge factor to ensure it
|
|
|
|
|
// doesn't prematurely wrap with slightly different font kerning or whatever, with a
|
|
|
|
|
// @media query
|
|
|
|
|
set-window-size: (850, 600)
|
|
|
|
|
|
|
|
|
|
// all counts and buttons still have same size
|
|
|
|
|
store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})
|
|
|
|
|
assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|})
|
|
|
|
|
assert-property: ("#search-tabs > button:nth-child(3)", {"offsetWidth": |buttonWidth|})
|
|
|
|
|
store-property: ("#search-tabs > button:nth-child(1) > .count", {"offsetWidth": countWidth})
|
|
|
|
|
assert-property: ("#search-tabs > button:nth-child(2) > .count", {"offsetWidth": |countWidth|})
|
|
|
|
|
assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": |countWidth|})
|
|
|
|
|
|
|
|
|
|
// Check that counts are still in a row with each other
|
|
|
|
|
compare-elements-position: (
|
|
|
|
|
"#search-tabs > button:nth-child(1) > .count",
|
|
|
|
|
"#search-tabs > button:nth-child(2) > .count",
|
2024-04-01 14:11:22 -05:00
|
|
|
|
["y"]
|
2023-09-19 21:40:36 -05:00
|
|
|
|
)
|
|
|
|
|
compare-elements-position: (
|
|
|
|
|
"#search-tabs > button:nth-child(2) > .count",
|
|
|
|
|
"#search-tabs > button:nth-child(3) > .count",
|
2024-04-01 14:11:22 -05:00
|
|
|
|
["y"]
|
2023-09-19 21:40:36 -05:00
|
|
|
|
)
|
|
|
|
|
// Check that counts are NOT beside the titles; now they have wrapped
|
|
|
|
|
compare-elements-position-near-false: (
|
|
|
|
|
"#search-tabs > button:nth-child(1)",
|
|
|
|
|
"#search-tabs > button:nth-child(1) > .count",
|
|
|
|
|
{"y": 8}
|
|
|
|
|
)
|
|
|
|
|
compare-elements-position-near-false: (
|
|
|
|
|
"#search-tabs > button:nth-child(2)",
|
|
|
|
|
"#search-tabs > button:nth-child(2) > .count",
|
|
|
|
|
{"y": 8}
|
|
|
|
|
)
|
|
|
|
|
compare-elements-position-near-false: (
|
|
|
|
|
"#search-tabs > button:nth-child(2)",
|
|
|
|
|
"#search-tabs > button:nth-child(2) > .count",
|
|
|
|
|
{"y": 8}
|
|
|
|
|
)
|