]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/escape-key.goml
Rollup merge of #91780 - cjgillot:localize, r=Mark-Simulacrum
[rust.git] / src / test / rustdoc-gui / escape-key.goml
1 goto: file://|DOC_PATH|/test_docs/index.html
2 // First, we check that the search results are hidden when the Escape key is pressed.
3 write: (".search-input", "test")
4 wait-for: "#search > h1" // The search element is empty before the first search 
5 assert-attribute: ("#search", {"class": "content"})
6 assert-attribute: ("#main-content", {"class": "content hidden"})
7 press-key: "Escape"
8 assert-attribute: ("#search", {"class": "content hidden"})
9 assert-attribute: ("#main-content", {"class": "content"})
10
11 // Check that focusing the search input brings back the search results
12 focus: ".search-input"
13 assert-attribute: ("#search", {"class": "content"})
14 assert-attribute: ("#main-content", {"class": "content hidden"})
15
16 // Now let's check that when the help popup is displayed and we press Escape, it doesn't
17 // hide the search results too.
18 click: "#help-button"
19 assert-attribute: ("#help", {"class": ""})
20 press-key: "Escape"
21 assert-attribute: ("#help", {"class": "hidden"})
22 assert-attribute: ("#search", {"class": "content"})
23 assert-attribute: ("#main-content", {"class": "content hidden"})
24
25 // Check that Escape hides the search results when a search result is focused.
26 focus: ".search-input"
27 assert: ".search-input:focus"
28 press-key: "ArrowDown"
29 assert-false: ".search-input:focus"
30 assert: "#results a:focus"
31 press-key: "Escape"
32 assert-attribute: ("#help", {"class": "hidden"})
33 assert-attribute: ("#search", {"class": "content hidden"})
34 assert-attribute: ("#main-content", {"class": "content"})