This fixes an issue where pressing `?` inside the ACE editor was opening the help popup. The solution here is to ensure that the global keypress handler works the same as the one used in the search handler. Fortunately other keypresses like left and right were working OK because ACE was doing something like stopPropagation (I'm not sure exactly). Fixes https://github.com/rust-lang/mdBook/issues/3064
24 lines
854 B
Text
24 lines
854 B
Text
// Tests for global keypress handlers when ACE editor is in focus.
|
|
// See https://github.com/rust-lang/mdBook/issues/3064
|
|
|
|
go-to: |DOC_PATH| + "editor/chapter_1.html"
|
|
|
|
click: ".ace_editor"
|
|
press-key: "s"
|
|
// Wait briefly to allow any event handlers triggered by the keypress to run.
|
|
// Otherwise there is a race here since the wrapper is already display:none.
|
|
wait-for: 200
|
|
wait-for-css: ("#mdbook-search-wrapper", {"display": "none"})
|
|
|
|
// ? inside ACE editor shouldn't show global help popup.
|
|
press-key: "?"
|
|
wait-for: 200
|
|
wait-for-css: ("#mdbook-help-container", {"display": "none"})
|
|
|
|
// Make sure arrow keys don"t navigate.
|
|
press-key: "ArrowRight"
|
|
wait-for: 200
|
|
assert-window-property: ({"location": |DOC_PATH| + "editor/chapter_1.html"})
|
|
press-key: "ArrowLeft"
|
|
wait-for: 200
|
|
assert-window-property: ({"location": |DOC_PATH| + "editor/chapter_1.html"})
|