Skip to content

Commit 034ac37

Browse files
committed
test: window splits
1 parent 394d7cf commit 034ac37

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

‎tests/test_splits.lua‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
local Helpers = dofile("tests/scripts/helpers.lua")
2+
local child = MiniTest.new_child_neovim()
3+
4+
local T = MiniTest.new_set({
5+
hooks = {
6+
pre_case = function()
7+
child.restart({ "-u", "tests/scripts/init_with_zen.lua" })
8+
end,
9+
post_once = child.stop,
10+
},
11+
})
12+
13+
T["vsplit"] = MiniTest.new_set({})
14+
15+
T["vsplit"]["opening closes zen buffers"] = function()
16+
child.cmd("edit test.lua")
17+
child.cmd("vsplit test2.lua")
18+
19+
Helpers.expect.layout(child, {
20+
type = "row",
21+
children = {
22+
{ type = "leaf", filetype = "lua", buftype = "", width = 120, height = 50 },
23+
{ type = "leaf", filetype = "lua", buftype = "", width = 119, height = 50 },
24+
},
25+
})
26+
end
27+
28+
T["vsplit"]["closing reopens zen side buffers"] = function()
29+
child.cmd("edit test.lua")
30+
child.cmd("vsplit test2.lua")
31+
child.cmd("q")
32+
33+
Helpers.expect.layout(child, {
34+
type = "row",
35+
children = {
36+
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 50 },
37+
{ type = "leaf", filetype = "lua", buftype = "", width = 146, height = 50 },
38+
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 50 },
39+
},
40+
})
41+
end
42+
43+
44+
T["vsplit"]["closing does not reopen zen side buffers when below minimum width"] = function()
45+
child.cmd("edit test.lua")
46+
child.cmd("vsplit test2.lua")
47+
48+
child.cmd("set columns-=100")
49+
child.cmd("doautocmd VimResized")
50+
51+
child.cmd("q")
52+
53+
Helpers.expect.layout(child, {
54+
type = "leaf",
55+
filetype = "lua",
56+
buftype = "",
57+
width = 140,
58+
height = 50,
59+
})
60+
end
61+
62+
63+
T["hsplit"] = MiniTest.new_set({})
64+
65+
T["hsplit"]["opening does not close the side buffers"] = function()
66+
-- TODO
67+
end
68+
69+
return T

0 commit comments

Comments
 (0)