]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/escape-key.goml
Rollup merge of #92959 - asquared31415:test-non-fn-help, r=estebank
[rust.git] / src / test / rustdoc-gui / escape-key.goml
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"})
9 press-key: "Escape"
10 assert-attribute: ("#search", {"class": "content hidden"})
11 assert-attribute: ("#main-content", {"class": "content"})
12
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"})
17
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.
20 click: "#help-button"
21 assert-attribute: ("#help", {"class": ""})
22 press-key: "Escape"
23 assert-attribute: ("#help", {"class": "hidden"})
24 assert-attribute: ("#search", {"class": "content"})
25 assert-attribute: ("#main-content", {"class": "content hidden"})
26
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"
33 press-key: "Escape"
34 assert-attribute: ("#help", {"class": "hidden"})
35 assert-attribute: ("#search", {"class": "content hidden"})
36 assert-attribute: ("#main-content", {"class": "content"})