-
Notifications
You must be signed in to change notification settings - Fork 274
/
ClipboardInsertModePasteMultiLineTest.re
49 lines (40 loc) · 1.41 KB
/
ClipboardInsertModePasteMultiLineTest.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
open Oni_Core;
open Oni_Model;
open Oni_IntegrationTestLib;
module Log = (
val Log.withNamespace("IntegrationTest.ClipboardInsertModePasteMultiLine")
);
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
);
dispatch(KeyboardInput({isText: true, input: "i"}));
wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);
setClipboard(Some("def\nghi"));
dispatch(KeyboardInput({isText: true, input: "A"}));
dispatch(Actions.Clipboard(Feature_Clipboard.Msg.paste));
wait(~name="Paste goes through", (state: State.t) =>
state
|> Selectors.getActiveBuffer
|> Option.map(buf => Buffer.getNumberOfLines(buf) == 2)
|> Option.value(~default=false)
);
dispatch(KeyboardInput({isText: true, input: "B"}));
runEffects();
wait(~name="Buffer is correct", (state: State.t) =>
switch (Selectors.getActiveBuffer(state)) {
| None => false
| Some(buf) =>
let line1 = Buffer.getLine(0, buf) |> BufferLine.raw;
prerr_endline("LINE1: " ++ line1);
let line2 = Buffer.getLine(1, buf) |> BufferLine.raw;
Log.info("Line1 is: " ++ line1 ++ "|");
Log.info("Line2 is: " ++ line2 ++ "|");
String.equal(line1, "Adef") && String.equal(line2, "ghiB");
}
);
});