| 1 |
// Tests for global keypress handlers when ACE editor is in focus. |
| 2 |
// See https://github.com/rust-lang/mdBook/issues/3064 |
| 3 |
|
| 4 |
go-to: |DOC_PATH| + "editor/chapter_1.html" |
| 5 |
|
| 6 |
click: ".ace_editor" |
| 7 |
press-key: "s" |
| 8 |
// Wait briefly to allow any event handlers triggered by the keypress to run. |
| 9 |
// Otherwise there is a race here since the wrapper is already display:none. |
| 10 |
wait-for: 200 |
| 11 |
wait-for-css: ("#mdbook-search-wrapper", {"display": "none"}) |
| 12 |
|
| 13 |
// ? inside ACE editor shouldn't show global help popup. |
| 14 |
press-key: "?" |
| 15 |
wait-for: 200 |
| 16 |
wait-for-css: ("#mdbook-help-container", {"display": "none"}) |
| 17 |
|
| 18 |
// Make sure arrow keys don"t navigate. |
| 19 |
press-key: "ArrowRight" |
| 20 |
wait-for: 200 |
| 21 |
assert-window-property: ({"location": |DOC_PATH| + "editor/chapter_1.html"}) |
| 22 |
press-key: "ArrowLeft" |
| 23 |
wait-for: 200 |
| 24 |
assert-window-property: ({"location": |DOC_PATH| + "editor/chapter_1.html"}) |