2022-01-21 13:41:47 -06:00
|
|
|
// Checks that the search results have the expected width.
|
2022-10-07 13:17:05 -05:00
|
|
|
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2021-05-22 09:41:26 -05:00
|
|
|
size: (900, 1000)
|
|
|
|
write: (".search-input", "test")
|
2022-07-16 06:53:43 -05:00
|
|
|
// To be SURE that the search will be run.
|
|
|
|
press-key: 'Enter'
|
2022-08-10 08:50:20 -05:00
|
|
|
wait-for: "#crate-search"
|
2021-05-22 09:41:26 -05:00
|
|
|
// The width is returned by "getComputedStyle" which returns the exact number instead of the
|
|
|
|
// CSS rule which is "50%"...
|
2022-11-04 14:34:24 -05:00
|
|
|
assert-css: (".search-results div.desc", {"width": "310px"})
|
2021-05-22 09:41:26 -05:00
|
|
|
size: (600, 100)
|
|
|
|
// As counter-intuitive as it may seem, in this width, the width is "100%", which is why
|
|
|
|
// when computed it's larger.
|
2022-09-09 13:48:43 -05:00
|
|
|
assert-css: (".search-results div.desc", {"width": "566px"})
|
2022-07-09 08:54:36 -05:00
|
|
|
|
2022-09-12 16:04:11 -05:00
|
|
|
// The result set is all on one line.
|
|
|
|
assert-css: (".search-results .result-name > span", {"display": "inline"})
|
|
|
|
|
2022-07-09 08:54:36 -05:00
|
|
|
// Check that the crate filter `<select>` is correctly handled when it goes to next line.
|
|
|
|
// To do so we need to update the length of one of its `<option>`.
|
|
|
|
size: (900, 900)
|
|
|
|
|
2022-08-10 08:50:20 -05:00
|
|
|
// First we check the current width, height and position.
|
|
|
|
assert-css: ("#crate-search", {"width": "223px"})
|
2023-02-12 13:27:40 -06:00
|
|
|
assert-css: (".search-results-title", {"height": "50px", "width": "640px"})
|
2022-11-23 14:28:06 -06:00
|
|
|
assert-css: ("#search", {"width": "640px"})
|
2022-07-09 08:54:36 -05:00
|
|
|
|
2022-08-10 08:50:20 -05:00
|
|
|
// Then we update the text of one of the `<option>`.
|
|
|
|
text: (
|
|
|
|
"#crate-search option",
|
|
|
|
"sdjfaksdjfaksjdbfkadsbfkjsadbfkdsbkfbsadkjfbkdsabfkadsfkjdsafa",
|
|
|
|
)
|
2022-07-09 08:54:36 -05:00
|
|
|
|
2022-08-10 08:50:20 -05:00
|
|
|
// Then we compare again to confirm the height didn't change.
|
|
|
|
assert-css: ("#crate-search", {"width": "527px"})
|
2023-02-12 13:27:40 -06:00
|
|
|
assert-css: (".search-results-title", {"height": "50px", "width": "640px"})
|
2022-08-10 08:50:20 -05:00
|
|
|
// And we check that the `<select>` isn't bigger than its container (".search-results-title").
|
|
|
|
assert-css: ("#search", {"width": "640px"})
|
2022-11-07 11:08:24 -06:00
|
|
|
|
|
|
|
// Now checking that the crate filter is working as expected too.
|
|
|
|
show-text: true
|
|
|
|
define-function: (
|
|
|
|
"check-filter",
|
|
|
|
(theme, border, filter, hover_border, hover_filter),
|
2023-01-06 08:18:51 -06:00
|
|
|
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"
|
|
|
|
},
|
2022-11-07 11:08:24 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
call-function: ("check-filter", {
|
|
|
|
"theme": "ayu",
|
|
|
|
"border": "rgb(92, 103, 115)",
|
|
|
|
"filter": "invert(0.41) sepia(0.12) saturate(4.87) hue-rotate(171deg) brightness(0.94) contrast(0.94)",
|
|
|
|
"hover_border": "rgb(224, 224, 224)",
|
|
|
|
"hover_filter": "invert(0.98) sepia(0.12) saturate(0.81) hue-rotate(343deg) brightness(1.13) contrast(0.76)",
|
|
|
|
})
|
|
|
|
call-function: ("check-filter", {
|
|
|
|
"theme": "dark",
|
|
|
|
"border": "rgb(224, 224, 224)",
|
|
|
|
"filter": "invert(0.94) sepia(0) saturate(7.21) hue-rotate(255deg) brightness(0.9) contrast(0.9)",
|
|
|
|
"hover_border": "rgb(33, 150, 243)",
|
|
|
|
"hover_filter": "invert(0.69) sepia(0.6) saturate(66.13) hue-rotate(184deg) brightness(1) contrast(0.91)",
|
|
|
|
})
|
|
|
|
call-function: ("check-filter", {
|
|
|
|
"theme": "light",
|
|
|
|
"border": "rgb(224, 224, 224)",
|
|
|
|
"filter": "invert(1) sepia(0) saturate(42.23) hue-rotate(289deg) brightness(1.14) contrast(0.76)",
|
|
|
|
"hover_border": "rgb(113, 113, 113)",
|
|
|
|
"hover_filter": "invert(0.44) sepia(0.18) saturate(0.23) hue-rotate(317deg) brightness(0.96) contrast(0.93)",
|
|
|
|
})
|