]>
Commit | Line | Data |
---|---|---|
5099ac24 FG |
1 | // This test ensures that the "Escape" shortcut is handled correctly based on the |
2 | // current content displayed. | |
2b03887a | 3 | goto: "file://" + |DOC_PATH| + "/test_docs/index.html" |
136023e0 XL |
4 | // First, we check that the search results are hidden when the Escape key is pressed. |
5 | write: (".search-input", "test") | |
064997fb FG |
6 | // To be SURE that the search will be run. |
7 | press-key: 'Enter' | |
5099ac24 | 8 | wait-for: "#search h1" // The search element is empty before the first search |
04454e1e FG |
9 | // Check that the currently displayed element is search. |
10 | wait-for: "#alternative-display #search" | |
a2a8927a | 11 | assert-attribute: ("#main-content", {"class": "content hidden"}) |
5e7ed085 | 12 | assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH) |
136023e0 | 13 | press-key: "Escape" |
04454e1e FG |
14 | // Checks that search is no longer in the displayed content. |
15 | wait-for: "#not-displayed #search" | |
16 | assert-false: "#alternative-display #search" | |
a2a8927a | 17 | assert-attribute: ("#main-content", {"class": "content"}) |
5e7ed085 | 18 | assert-document-property: ({"URL": "index.html"}, [ENDS_WITH]) |
136023e0 XL |
19 | |
20 | // Check that focusing the search input brings back the search results | |
21 | focus: ".search-input" | |
04454e1e | 22 | wait-for: "#alternative-display #search" |
a2a8927a | 23 | assert-attribute: ("#main-content", {"class": "content hidden"}) |
5e7ed085 | 24 | assert-document-property: ({"URL": "index.html?search=test"}, ENDS_WITH) |
136023e0 | 25 | |
136023e0 XL |
26 | // Check that Escape hides the search results when a search result is focused. |
27 | focus: ".search-input" | |
28 | assert: ".search-input:focus" | |
29 | press-key: "ArrowDown" | |
30 | assert-false: ".search-input:focus" | |
31 | assert: "#results a:focus" | |
32 | press-key: "Escape" | |
04454e1e FG |
33 | wait-for: "#not-displayed #search" |
34 | assert-false: "#alternative-display #search" | |
a2a8927a | 35 | assert-attribute: ("#main-content", {"class": "content"}) |