rust/tests/rustdoc-gui/search-filter.goml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

91 lines
2.9 KiB
Plaintext
Raw Normal View History

2022-01-21 13:41:47 -06:00
// Checks that the crate search filtering is handled correctly and changes the results.
include: "utils.goml"
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
2021-11-24 11:01:34 -06:00
show-text: true
2024-04-01 14:11:22 -05:00
write-into: (".search-input", "test")
2022-07-16 06:53:43 -05:00
// To be SURE that the search will be run.
press-key: 'Enter'
2021-06-22 05:06:09 -05:00
// Waiting for the search results to appear...
wait-for: "#search-tabs"
2021-06-22 05:06:09 -05:00
assert-text: ("#results .externcrate", "test_docs")
2021-11-24 11:01:34 -06:00
wait-for: "#crate-search"
2021-06-22 05:06:09 -05:00
// We now want to change the crate filter.
click: "#crate-search"
// We select "lib2" option then press enter to change the filter.
press-key: "ArrowDown"
press-key: "ArrowDown"
2022-11-05 12:14:31 -05:00
press-key: "ArrowDown"
press-key: "ArrowDown"
press-key: "ArrowDown"
2021-06-22 05:06:09 -05:00
press-key: "Enter"
// Waiting for the search results to appear...
wait-for: "#search-tabs"
2022-03-15 14:56:14 -05:00
assert-document-property: ({"URL": "&filter-crate="}, CONTAINS)
2021-06-22 05:06:09 -05:00
// We check that there is no more "test_docs" appearing.
assert-false: "#results .externcrate"
// We also check that "lib2" is the filter crate.
assert-property: ("#crate-search", {"value": "lib2"})
// Now we check that leaving the search results and putting them back keeps the
// crate filtering.
press-key: "Escape"
wait-for-css: ("#main-content", {"display": "block"})
focus: ".search-input"
wait-for-css: ("#main-content", {"display": "none"})
// We check that there is no more "test_docs" appearing.
assert-false: "#results .externcrate"
assert-property: ("#crate-search", {"value": "lib2"})
// Selecting back "All crates"
click: "#crate-search"
press-key: "ArrowUp"
press-key: "ArrowUp"
2022-11-05 12:14:31 -05:00
press-key: "ArrowUp"
press-key: "ArrowUp"
press-key: "ArrowUp"
press-key: "Enter"
// Waiting for the search results to appear...
wait-for: "#search-tabs"
Improve crate selection on rustdoc search results page Resolves all of issue #93240 Reproduces a similar change as #99086, but with improvements In particular, this PR inlcludes: * redesigning the crate-search selector so the background color matches its surroundings * decrease the font of the dropdown menu to a reaonable size * add a hover effect * make the color of the arrow theme-dependent, using a surrounding div, with :after pseudo-element that can then be transformed using CSS filters to approximate the desired color * fix the text "in" to match the title font * remove the "for xyz" in the "Results for xyz in [All crates]" title when searching for search term "xyz"; you can already see what you're searching for as it's typed in the search bar! * in line with #99086, handle super-long crate names appropriately without a long <select> element escaping the screen area; the improvement is that we also keep the title within a single line now; uses some flex layout shenanigans... * the margins / paddings are adjusted so the selected label of the <select> fits within the rest of that title nicely; also some inconsistency in the way that Firefox renders a <select> with "appearance: none" (roughly 4px more padding left and right of the text than e.g. Chrome) is worked around, and it now produces a result that looks (essentially) identical to Chrome * the color of the help menu and settings menu border in light theme is made to match with the color of the corresponding buttons, like they do (match) in the ayu theme * the casing of "All crates" changes to "all crates" * the new tests from #99086 are temporarily disabled, until they can be adapted later
2022-07-03 13:10:19 -05:00
assert-property: ("#crate-search", {"value": "all crates"})
// Checking that the URL parameter is taken into account for crate filtering.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=test&filter-crate=lib2"
wait-for: "#crate-search"
assert-property: ("#crate-search", {"value": "lib2"})
assert-false: "#results .externcrate"
2022-05-17 06:28:22 -05:00
Improve crate selection on rustdoc search results page Resolves all of issue #93240 Reproduces a similar change as #99086, but with improvements In particular, this PR inlcludes: * redesigning the crate-search selector so the background color matches its surroundings * decrease the font of the dropdown menu to a reaonable size * add a hover effect * make the color of the arrow theme-dependent, using a surrounding div, with :after pseudo-element that can then be transformed using CSS filters to approximate the desired color * fix the text "in" to match the title font * remove the "for xyz" in the "Results for xyz in [All crates]" title when searching for search term "xyz"; you can already see what you're searching for as it's typed in the search bar! * in line with #99086, handle super-long crate names appropriately without a long <select> element escaping the screen area; the improvement is that we also keep the title within a single line now; uses some flex layout shenanigans... * the margins / paddings are adjusted so the selected label of the <select> fits within the rest of that title nicely; also some inconsistency in the way that Firefox renders a <select> with "appearance: none" (roughly 4px more padding left and right of the text than e.g. Chrome) is worked around, and it now produces a result that looks (essentially) identical to Chrome * the color of the help menu and settings menu border in light theme is made to match with the color of the corresponding buttons, like they do (match) in the ayu theme * the casing of "All crates" changes to "all crates" * the new tests from #99086 are temporarily disabled, until they can be adapted later
2022-07-03 13:10:19 -05:00
// Checking that the text for the "title" is correct (the "all crates" comes from the "<select>").
assert-text: (".search-results-title", "Results", STARTS_WITH)
assert-text: (".search-results-title + .sub-heading", " in all crates", STARTS_WITH)
// Checking the display of the crate filter.
// We start with the light theme.
call-function: ("switch-theme", {"theme": "light"})
set-timeout: 2000
wait-for: "#crate-search"
assert-css: ("#crate-search", {
"border": "1px solid #e0e0e0",
"color": "black",
"background-color": "white",
})
// We now check the dark theme.
click: "#settings-menu"
wait-for: "#settings"
click: "#theme-dark"
wait-for-css: ("#crate-search", {
"border": "1px solid #e0e0e0",
"color": "#ddd",
"background-color": "#353535",
})
// And finally we check the ayu theme.
click: "#theme-ayu"
wait-for-css: ("#crate-search", {
"border": "1px solid #5c6773",
"color": "#c5c5c5",
"background-color": "#0f1419",
})