2022-01-21 19:41:47 +00:00
|
|
|
// This test ensures that the "Escape" shortcut is handled correctly based on the
|
|
|
|
// current content displayed.
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2021-05-18 12:51:54 +00:00
|
|
|
// First, we check that the search results are hidden when the Escape key is pressed.
|
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'
|
2023-01-08 20:29:57 +00:00
|
|
|
wait-for: "#search h1" // The search element is empty before the first search
|
2022-01-19 22:06:17 +00:00
|
|
|
// Check that the currently displayed element is search.
|
|
|
|
wait-for: "#alternative-display #search"
|
2021-11-29 16:14:05 +00:00
|
|
|
assert-attribute: ("#main-content", {"class": "content hidden"})
|
2022-03-15 19:56:14 +00:00
|
|
|
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
|
2021-05-18 12:51:54 +00:00
|
|
|
press-key: "Escape"
|
2022-01-19 22:06:17 +00:00
|
|
|
// Checks that search is no longer in the displayed content.
|
|
|
|
wait-for: "#not-displayed #search"
|
|
|
|
assert-false: "#alternative-display #search"
|
2021-11-29 16:14:05 +00:00
|
|
|
assert-attribute: ("#main-content", {"class": "content"})
|
2022-03-15 19:56:14 +00:00
|
|
|
assert-document-property: ({"URL": "index.html"}, [ENDS_WITH])
|
2021-05-18 12:51:54 +00:00
|
|
|
|
|
|
|
// Check that focusing the search input brings back the search results
|
|
|
|
focus: ".search-input"
|
2022-01-19 22:06:17 +00:00
|
|
|
wait-for: "#alternative-display #search"
|
2021-11-29 16:14:05 +00:00
|
|
|
assert-attribute: ("#main-content", {"class": "content hidden"})
|
2022-03-15 19:56:14 +00:00
|
|
|
assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH)
|
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"
|
2022-01-19 22:06:17 +00:00
|
|
|
wait-for: "#not-displayed #search"
|
|
|
|
assert-false: "#alternative-display #search"
|
2021-11-29 16:14:05 +00:00
|
|
|
assert-attribute: ("#main-content", {"class": "content"})
|