Add a test for global keypress with ACE editor focused
This is a regression test for https://github.com/rust-lang/mdBook/issues/3064.
This commit is contained in:
parent
22f3035df0
commit
4adc4b08ba
5 changed files with 41 additions and 0 deletions
6
tests/gui/books/editor/book.toml
Normal file
6
tests/gui/books/editor/book.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[book]
|
||||||
|
title = "editor"
|
||||||
|
language = "en"
|
||||||
|
|
||||||
|
[output.html.playground]
|
||||||
|
editable = true
|
||||||
4
tests/gui/books/editor/src/SUMMARY.md
Normal file
4
tests/gui/books/editor/src/SUMMARY.md
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Summary
|
||||||
|
|
||||||
|
- [Chapter 1](./chapter_1.md)
|
||||||
|
- [Chapter 2](./chapter_2.md)
|
||||||
7
tests/gui/books/editor/src/chapter_1.md
Normal file
7
tests/gui/books/editor/src/chapter_1.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Chapter 1
|
||||||
|
|
||||||
|
```rust,editable
|
||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
|
```
|
||||||
1
tests/gui/books/editor/src/chapter_2.md
Normal file
1
tests/gui/books/editor/src/chapter_2.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# Chapter 2
|
||||||
23
tests/gui/editor-keypress.goml
Normal file
23
tests/gui/editor-keypress.goml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
// 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"})
|
||||||
|
|
||||||
|
press-key: "?"
|
||||||
|
wait-for: 200
|
||||||
|
wait-for-css: ("#mdbook-help-container", {"display": "flex"})
|
||||||
|
|
||||||
|
// 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"})
|
||||||
Loading…
Add table
Reference in a new issue