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