rust/src/test/rustdoc-gui/escape-key.goml

35 lines
1.4 KiB
Plaintext
Raw Normal View History

2021-05-18 12:51:54 +00:00
goto: file://|DOC_PATH|/test_docs/index.html
// First, we check that the search results are hidden when the Escape key is pressed.
write: (".search-input", "test")
wait-for: "#search > h1" // The search element is empty before the first search
2021-06-22 09:11:45 +00:00
assert-attribute: ("#search", {"class": "content"})
assert-attribute: ("#main", {"class": "content hidden"})
2021-05-18 12:51:54 +00:00
press-key: "Escape"
2021-06-22 09:11:45 +00:00
assert-attribute: ("#search", {"class": "content hidden"})
assert-attribute: ("#main", {"class": "content"})
2021-05-18 12:51:54 +00:00
// Check that focusing the search input brings back the search results
focus: ".search-input"
2021-06-22 09:11:45 +00:00
assert-attribute: ("#search", {"class": "content"})
assert-attribute: ("#main", {"class": "content hidden"})
2021-05-18 12:51:54 +00:00
// Now let's check that when the help popup is displayed and we press Escape, it doesn't
// hide the search results too.
click: "#help-button"
2021-06-22 09:11:45 +00:00
assert-attribute: ("#help", {"class": ""})
2021-05-18 12:51:54 +00:00
press-key: "Escape"
2021-06-22 09:11:45 +00:00
assert-attribute: ("#help", {"class": "hidden"})
assert-attribute: ("#search", {"class": "content"})
assert-attribute: ("#main", {"class": "content hidden"})
2021-05-18 12:51:54 +00:00
2021-05-20 11:37:29 +00:00
// Check that Escape hides the search results when a search result is focused.
focus: ".search-input"
assert: ".search-input:focus"
press-key: "ArrowDown"
assert-false: ".search-input:focus"
assert: "#results a:focus"
press-key: "Escape"
2021-06-22 09:11:45 +00:00
assert-attribute: ("#help", {"class": "hidden"})
assert-attribute: ("#search", {"class": "content hidden"})
assert-attribute: ("#main", {"class": "content"})