forked from onivim/oni2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TypingUnbatchedTest.re
40 lines (31 loc) · 1.09 KB
/
TypingUnbatchedTest.re
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
open Oni_Core;
open Oni_Model;
open Oni_IntegrationTestLib;
module Log = (val Log.withNamespace("IntegrationTest.TypingUnbatched"));
runTest(
~name="InsertMode test - effects batched to runEffects",
({dispatch, wait, runEffects, _}) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Selectors.mode(state) |> Vim.Mode.isNormal
);
dispatch(KeyboardInput({isText: true, input: "i"}));
wait(~name="Mode switches to insert", (state: State.t) =>
Selectors.mode(state) |> Vim.Mode.isInsert
);
/* Simulate multiple events getting dispatched before running effects */
dispatch(KeyboardInput({isText: true, input: "A"}));
runEffects();
dispatch(KeyboardInput({isText: true, input: "B"}));
runEffects();
dispatch(KeyboardInput({isText: true, input: "C"}));
runEffects();
wait(~name="Buffer shows ABC", (state: State.t) =>
switch (Selectors.getActiveBuffer(state)) {
| None => false
| Some(buf) =>
let line = Buffer.getLine(0, buf) |> BufferLine.raw;
Log.info("Current line is: |" ++ line ++ "|");
String.equal(line, "ABC");
}
);
});