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