forked from onivim/oni2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddRemoveSplitTest.re
53 lines (41 loc) · 1.35 KB
/
AddRemoveSplitTest.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
open Oni_Model;
open Oni_IntegrationTestLib;
runTest(~name="AddRemoveSplitTest", ({dispatch, wait, _}) => {
wait(~name="Wait for split to be created 1", (state: State.t) => {
let splitCount =
state.layout |> Feature_Layout.visibleEditors |> List.length;
splitCount == 1;
});
let initialEditorId: ref(option(int)) = ref(None);
wait(~name="Wait for initial editor", (state: State.t) => {
initialEditorId :=
Some(
Feature_Layout.activeEditor(state.layout)
|> Feature_Editor.Editor.getId,
);
true;
});
runCommand(
~dispatch,
Feature_Layout.Commands.splitVertical
|> Core.Command.map(msg => Model.Actions.Layout(msg)),
);
wait(
~name="Wait for split to be created, and editor to be focused",
(state: State.t) => {
let splitCount =
state.layout |> Feature_Layout.visibleEditors |> List.length;
let editorId =
state.layout
|> Feature_Layout.activeEditor
|> Feature_Editor.Editor.getId;
splitCount == 2 && Some(editorId) != initialEditorId^;
});
dispatch(QuitBuffer(Vim.Buffer.getCurrent(), false));
wait(~name="Wait for split to be closed", (state: State.t) => {
let splitCount =
state.layout |> Feature_Layout.visibleEditors |> List.length;
prerr_endline("Split count: " ++ string_of_int(splitCount));
splitCount == 1;
});
});