-
Notifications
You must be signed in to change notification settings - Fork 274
/
SearchShowClearHighlightsTest.re
61 lines (50 loc) · 1.8 KB
/
SearchShowClearHighlightsTest.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
open Oni_Core;
open Oni_Model;
open Oni_IntegrationTestLib;
open Oni_Syntax;
runTest(
~name="InsertMode test - effects batched to runEffects",
(dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);
// Edit
dispatch(KeyboardInput({isText: true, input: "i"}));
wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);
dispatch(KeyboardInput({isText: true, input: "a"}));
dispatch(KeyboardInput({isText: true, input: "b"}));
dispatch(KeyboardInput({isText: true, input: "c"}));
dispatch(KeyboardInput({isText: false, input: "<esc>"}));
dispatch(KeyboardInput({isText: true, input: "/"}));
dispatch(KeyboardInput({isText: true, input: "a"}));
dispatch(KeyboardInput({isText: false, input: "<cr>"}));
runEffects();
wait(~name="Buffer has search highlights for 'a'", (state: State.t) =>
switch (Selectors.getActiveBuffer(state)) {
| None => false
| Some(buf) =>
let bufferId = Buffer.getId(buf);
let searchHighlightCount =
BufferHighlights.getHighlights(~bufferId, state.bufferHighlights)
|> List.length;
searchHighlightCount > 0;
}
);
dispatch(KeyboardInput({isText: true, input: ":"}));
dispatch(KeyboardInput({isText: true, input: "nohl"}));
dispatch(KeyboardInput({isText: false, input: "<cr>"}));
runEffects();
wait(~name="Buffer search highlights are cleared", (state: State.t) =>
switch (Selectors.getActiveBuffer(state)) {
| None => false
| Some(buf) =>
let bufferId = Buffer.getId(buf);
let searchHighlightCount =
BufferHighlights.getHighlights(~bufferId, state.bufferHighlights)
|> List.length;
searchHighlightCount == 0;
}
);
});