2026-04-27 15:32:09 -07:00
|
|
|
// 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"})
|
|
|
|
|
|
2026-05-04 11:48:41 -07:00
|
|
|
// ? inside ACE editor shouldn't show global help popup.
|
2026-04-27 15:32:09 -07:00
|
|
|
press-key: "?"
|
|
|
|
|
wait-for: 200
|
2026-05-04 11:48:41 -07:00
|
|
|
wait-for-css: ("#mdbook-help-container", {"display": "none"})
|
2026-04-27 15:32:09 -07:00
|
|
|
|
|
|
|
|
// 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"})
|