forked from onivim/oni2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEditorSplitFileTest.re
59 lines (48 loc) · 1.58 KB
/
EditorSplitFileTest.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
open Oni_Model;
open Oni_IntegrationTestLib;
runTest(
~name="#2900: Splitting with a file should just show file",
({dispatch, wait, runEffects, _}) => {
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;
});
dispatch(
VimExecuteCommand({allowAnimation: true, command: "vsp some-file.json"}),
);
runEffects();
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^;
});
wait(~name="Verify that both groups have a single editor", (state: State.t) => {
let groups = state.layout |> Feature_Layout.activeLayoutGroups;
prerr_endline("Groups count: " ++ string_of_int(List.length(groups)));
groups
|> List.for_all(group => {
let editorsInGroup =
List.length(Feature_Layout.Group.allEditors(group));
prerr_endline(
"Editors in group: " ++ string_of_int(editorsInGroup),
);
editorsInGroup == 1;
});
});
});