1 // This test ensures that the "Escape" shortcut is handled correctly based on the
2 // current content displayed.
3 goto: file://|DOC_PATH|/test_docs/index.html
4 // First, we check that the search results are hidden when the Escape key is pressed.
5 write: (".search-input", "test")
6 wait-for: "#search h1" // The search element is empty before the first search
7 assert-attribute: ("#search", {"class": "content"})
8 assert-attribute: ("#main-content", {"class": "content hidden"})
10 assert-attribute: ("#search", {"class": "content hidden"})
11 assert-attribute: ("#main-content", {"class": "content"})
13 // Check that focusing the search input brings back the search results
14 focus: ".search-input"
15 assert-attribute: ("#search", {"class": "content"})
16 assert-attribute: ("#main-content", {"class": "content hidden"})
18 // Now let's check that when the help popup is displayed and we press Escape, it doesn't
19 // hide the search results too.
21 assert-attribute: ("#help", {"class": ""})
23 assert-attribute: ("#help", {"class": "hidden"})
24 assert-attribute: ("#search", {"class": "content"})
25 assert-attribute: ("#main-content", {"class": "content hidden"})
27 // Check that Escape hides the search results when a search result is focused.
28 focus: ".search-input"
29 assert: ".search-input:focus"
30 press-key: "ArrowDown"
31 assert-false: ".search-input:focus"
32 assert: "#results a:focus"
34 assert-attribute: ("#help", {"class": "hidden"})
35 assert-attribute: ("#search", {"class": "content hidden"})
36 assert-attribute: ("#main-content", {"class": "content"})