2023-06-27 14:26:22 +00:00
|
|
|
// ignore-tidy-linelength
|
2022-01-21 19:41:47 +00:00
|
|
|
// Checks that the search results have the expected width.
|
2024-04-05 19:38:55 +00:00
|
|
|
include: "utils.goml"
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
|
|
|
set-window-size: (900, 1000)
|
2024-04-01 19:11:22 +00:00
|
|
|
write-into: (".search-input", "test")
|
2022-07-16 11:53:43 +00:00
|
|
|
// To be SURE that the search will be run.
|
|
|
|
press-key: 'Enter'
|
2022-08-10 13:50:20 +00:00
|
|
|
wait-for: "#crate-search"
|
2021-05-22 14:41:26 +00:00
|
|
|
// The width is returned by "getComputedStyle" which returns the exact number instead of the
|
|
|
|
// CSS rule which is "50%"...
|
2023-06-27 14:26:22 +00:00
|
|
|
assert-size: (".search-results div.desc", {"width": 248})
|
|
|
|
store-size: (".search-results .result-name .typename", {"width": width})
|
2023-04-11 17:11:34 +00:00
|
|
|
set-window-size: (600, 100)
|
2021-05-22 14:41:26 +00:00
|
|
|
// As counter-intuitive as it may seem, in this width, the width is "100%", which is why
|
|
|
|
// when computed it's larger.
|
2023-05-18 14:16:13 +00:00
|
|
|
assert-size: (".search-results div.desc", {"width": 566})
|
2022-07-09 13:54:36 +00:00
|
|
|
|
2022-09-12 21:04:11 +00:00
|
|
|
// The result set is all on one line.
|
2023-06-27 14:26:22 +00:00
|
|
|
compare-elements-position-near: (
|
|
|
|
".search-results .result-name .typename",
|
|
|
|
".search-results .result-name .path",
|
|
|
|
{"y": 2},
|
|
|
|
)
|
|
|
|
compare-elements-position-near-false: (
|
|
|
|
".search-results .result-name .typename",
|
|
|
|
".search-results .result-name .path",
|
|
|
|
{"x": 5},
|
|
|
|
)
|
|
|
|
// The width of the "typename" isn't fixed anymore in this display mode.
|
|
|
|
store-size: (".search-results .result-name .typename", {"width": new_width})
|
|
|
|
assert: |new_width| < |width| - 10
|
|
|
|
|
|
|
|
// Check that if the search is too long on mobile, it'll go under the "typename".
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName"
|
|
|
|
wait-for: "#crate-search"
|
|
|
|
compare-elements-position-near: (
|
|
|
|
".search-results .result-name .typename",
|
|
|
|
".search-results .result-name .path",
|
|
|
|
{"y": 2, "x": 0},
|
|
|
|
)
|
2023-06-30 09:44:21 +00:00
|
|
|
compare-elements-size-near: (
|
|
|
|
".search-results .result-name",
|
|
|
|
".search-results .result-name .path",
|
|
|
|
{"width": 8, "height": 8},
|
|
|
|
)
|
2022-09-12 21:04:11 +00:00
|
|
|
|
2022-07-09 13:54:36 +00: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>`.
|
2023-04-11 17:11:34 +00:00
|
|
|
set-window-size: (900, 900)
|
2022-07-09 13:54:36 +00:00
|
|
|
|
2022-08-10 13:50:20 +00:00
|
|
|
// First we check the current width, height and position.
|
2024-09-03 02:42:28 +00:00
|
|
|
assert-css: ("#crate-search", {"width": "159px"})
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 06:11:30 +00:00
|
|
|
store-size: (".search-results-title", {
|
|
|
|
"height": search_results_title_height,
|
|
|
|
"width": search_results_title_width,
|
|
|
|
})
|
2022-11-23 20:28:06 +00:00
|
|
|
assert-css: ("#search", {"width": "640px"})
|
2022-07-09 13:54:36 +00:00
|
|
|
|
2022-08-10 13:50:20 +00:00
|
|
|
// Then we update the text of one of the `<option>`.
|
2023-04-11 17:11:34 +00:00
|
|
|
set-text: (
|
2022-08-10 13:50:20 +00:00
|
|
|
"#crate-search option",
|
|
|
|
"sdjfaksdjfaksjdbfkadsbfkjsadbfkdsbkfbsadkjfbkdsabfkadsfkjdsafa",
|
|
|
|
)
|
2022-07-09 13:54:36 +00:00
|
|
|
|
2022-08-10 13:50:20 +00:00
|
|
|
// Then we compare again to confirm the height didn't change.
|
2024-09-03 02:42:28 +00:00
|
|
|
assert-size: ("#crate-search", {"width": 509})
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 06:11:30 +00:00
|
|
|
assert-size: (".search-results-title", {
|
|
|
|
"height": |search_results_title_height|,
|
|
|
|
})
|
2022-08-10 13:50:20 +00:00
|
|
|
assert-css: ("#search", {"width": "640px"})
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 06:11:30 +00:00
|
|
|
assert: |search_results_title_width| <= 640
|
2022-11-07 17:08:24 +00:00
|
|
|
|
|
|
|
// Now checking that the crate filter is working as expected too.
|
|
|
|
show-text: true
|
|
|
|
define-function: (
|
|
|
|
"check-filter",
|
2024-04-01 19:11:22 +00:00
|
|
|
[theme, border, filter, hover_border, hover_filter],
|
2023-01-06 14:18:51 +00:00
|
|
|
block {
|
2024-04-05 19:38:55 +00:00
|
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
2023-01-06 14:18:51 +00:00
|
|
|
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 17:08:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
call-function: ("check-filter", {
|
|
|
|
"theme": "ayu",
|
2023-05-28 14:18:56 +00:00
|
|
|
"border": "#5c6773",
|
2022-11-07 17:08:24 +00:00
|
|
|
"filter": "invert(0.41) sepia(0.12) saturate(4.87) hue-rotate(171deg) brightness(0.94) contrast(0.94)",
|
2023-05-28 14:18:56 +00:00
|
|
|
"hover_border": "#e0e0e0",
|
2022-11-07 17:08:24 +00:00
|
|
|
"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",
|
2023-05-28 14:18:56 +00:00
|
|
|
"border": "#e0e0e0",
|
2022-11-07 17:08:24 +00:00
|
|
|
"filter": "invert(0.94) sepia(0) saturate(7.21) hue-rotate(255deg) brightness(0.9) contrast(0.9)",
|
2023-05-28 14:18:56 +00:00
|
|
|
"hover_border": "#2196f3",
|
2022-11-07 17:08:24 +00:00
|
|
|
"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",
|
2023-05-28 14:18:56 +00:00
|
|
|
"border": "#e0e0e0",
|
2022-11-07 17:08:24 +00:00
|
|
|
"filter": "invert(1) sepia(0) saturate(42.23) hue-rotate(289deg) brightness(1.14) contrast(0.76)",
|
2023-05-28 14:18:56 +00:00
|
|
|
"hover_border": "#717171",
|
2022-11-07 17:08:24 +00:00
|
|
|
"hover_filter": "invert(0.44) sepia(0.18) saturate(0.23) hue-rotate(317deg) brightness(0.96) contrast(0.93)",
|
|
|
|
})
|