mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
d05323c7b4
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.
128 lines
3.9 KiB
Plaintext
128 lines
3.9 KiB
Plaintext
// This test ensures that the elements in ".search-form" have the expected display.
|
|
include: "utils.goml"
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test"
|
|
wait-for: "#search-tabs" // Waiting for the search.js to load.
|
|
show-text: true
|
|
|
|
define-function: (
|
|
"check-search-colors",
|
|
[
|
|
theme, border, background, search_input_color, search_input_border_focus,
|
|
menu_button_a_color, menu_button_a_border_hover, menu_a_color,
|
|
],
|
|
block {
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
|
assert-css: (
|
|
".search-input",
|
|
{
|
|
"border-color": |border|,
|
|
"background-color": |background|,
|
|
"color": |search_input_color|,
|
|
},
|
|
)
|
|
// Focus on search input.
|
|
focus: ".search-input"
|
|
assert-css: (
|
|
".search-input",
|
|
{
|
|
"border-color": |search_input_border_focus|,
|
|
"background-color": |background|,
|
|
"color": |search_input_color|,
|
|
},
|
|
)
|
|
assert-css: (
|
|
"#help-button > a",
|
|
{
|
|
"color": |menu_button_a_color|,
|
|
"border-color": "transparent",
|
|
"background-color": "transparent",
|
|
},
|
|
)
|
|
// Hover help button.
|
|
move-cursor-to: "#help-button"
|
|
assert-css: (
|
|
"#help-button > a",
|
|
{
|
|
"color": |menu_button_a_color|,
|
|
"border-color": |menu_button_a_border_hover|,
|
|
"background-color": "transparent",
|
|
},
|
|
)
|
|
// Link color inside
|
|
click: "#help-button"
|
|
assert-css: (
|
|
"#help a",
|
|
{
|
|
"color": |menu_a_color|,
|
|
},
|
|
)
|
|
assert-css: (
|
|
"#settings-menu > a",
|
|
{
|
|
"color": |menu_button_a_color|,
|
|
"border-color": "transparent",
|
|
"background-color": "transparent",
|
|
},
|
|
)
|
|
// Hover settings menu.
|
|
move-cursor-to: "#settings-menu"
|
|
assert-css: (
|
|
"#settings-menu:hover > a",
|
|
{
|
|
"color": |menu_button_a_color|,
|
|
"border-color": |menu_button_a_border_hover|,
|
|
"background-color": "transparent",
|
|
},
|
|
)
|
|
},
|
|
)
|
|
|
|
call-function: (
|
|
"check-search-colors",
|
|
{
|
|
"theme": "ayu",
|
|
"border": "#5c6773",
|
|
"background": "#141920",
|
|
"search_input_color": "#fff",
|
|
"search_input_border_focus": "#5c6773",
|
|
"menu_button_a_color": "#c5c5c5",
|
|
"menu_button_a_border_hover": "#e0e0e0",
|
|
"menu_a_color": "#39afd7",
|
|
}
|
|
)
|
|
call-function: (
|
|
"check-search-colors",
|
|
{
|
|
"theme": "dark",
|
|
"border": "#e0e0e0",
|
|
"background": "#f0f0f0",
|
|
"search_input_color": "#111",
|
|
"search_input_border_focus": "#008dfd",
|
|
"menu_button_a_color": "#ddd",
|
|
"menu_button_a_border_hover": "#ffb900",
|
|
"menu_a_color": "#d2991d",
|
|
}
|
|
)
|
|
call-function: (
|
|
"check-search-colors",
|
|
{
|
|
"theme": "light",
|
|
"border": "#e0e0e0",
|
|
"background": "#fff",
|
|
"search_input_color": "#000",
|
|
"search_input_border_focus": "#66afe9",
|
|
"menu_button_a_color": "#000",
|
|
"menu_button_a_border_hover": "#717171",
|
|
"menu_a_color": "#3873ad",
|
|
}
|
|
)
|
|
|
|
// Check that search input correctly decodes form encoding.
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a+b"
|
|
wait-for: "#search-tabs" // Waiting for the search.js to load.
|
|
assert-property: (".search-input", { "value": "a b" })
|
|
// Check that literal + is not treated as space.
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=a%2Bb"
|
|
wait-for: "#search-tabs" // Waiting for the search.js to load.
|
|
assert-property: (".search-input", { "value": "a+b" })
|