mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
6a94e87a54
rustdoc: Add search result item types after their name Here what it looks like: ![Screenshot from 2023-04-22 15-16-58](https://user-images.githubusercontent.com/3050060/233789566-b5f3f625-3b78-4c56-a7ee-0a4f2d62e667.png) The idea is to improve accessibility by providing this information directly in the text and not only in the text color. Currently we already use it for doc aliases and for primitive types, so I extended it to all types. r? `@notriddle`
34 lines
1.6 KiB
Plaintext
34 lines
1.6 KiB
Plaintext
// Checks that the reexports are present in the search index, can have
|
|
// doc aliases and are highligted when their ID is the hash of the page.
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
|
set-local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
|
|
reload:
|
|
// First we check that the reexport has the correct ID and no background color.
|
|
assert-text: ("//*[@id='reexport.TheStdReexport']", "pub use ::std as TheStdReexport;")
|
|
assert-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgba(0, 0, 0, 0)"})
|
|
write: (".search-input", "TheStdReexport")
|
|
// To be SURE that the search will be run.
|
|
press-key: 'Enter'
|
|
wait-for: "//a[@class='result-import']"
|
|
assert-attribute: (
|
|
"//a[@class='result-import']",
|
|
{"href": "../test_docs/index.html#reexport.TheStdReexport"},
|
|
)
|
|
assert-text: ("a.result-import .result-name", "re-export test_docs::TheStdReexport")
|
|
click: "//a[@class='result-import']"
|
|
// We check that it has the background modified thanks to the focus.
|
|
wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "#494a3d"})
|
|
|
|
// We now check that the alias is working as well on the reexport.
|
|
// To be SURE that the search will be run.
|
|
press-key: 'Enter'
|
|
write: (".search-input", "AliasForTheStdReexport")
|
|
wait-for: "//a[@class='result-import']"
|
|
assert-text: (
|
|
"a.result-import .result-name",
|
|
"AliasForTheStdReexport - see re-export test_docs::TheStdReexport",
|
|
)
|
|
// Same thing again, we click on it to ensure the background is once again set as expected.
|
|
click: "//a[@class='result-import']"
|
|
wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "#494a3d"})
|