@@ -36,6 +36,44 @@ T["left integration"]["opening closes zen side buffer, closing reopens it"] = fu
3636 })
3737end
3838
39+ T [" left integration" ][" opening a left integration preserves an existing top integration" ] = function ()
40+ child .cmd (" Git" )
41+ child .lua (" vim.cmd('Fyler kind=split_left_most')" )
42+
43+ Helpers .expect .layout (child , {
44+ type = " col" ,
45+ children = {
46+ { type = " leaf" , filetype = " fugitive" , buftype = " nowrite" , width = 240 , height = 25 },
47+ {
48+ type = " row" ,
49+ children = {
50+ { type = " leaf" , filetype = " fyler_finder" , buftype = " acwrite" , width = 46 , height = 24 },
51+ { type = " leaf" , filetype = " " , buftype = " " , width = 146 , height = 24 },
52+ { type = " leaf" , filetype = " zen-right" , buftype = " nofile" , width = 46 , height = 24 },
53+ },
54+ },
55+ },
56+ })
57+
58+ child .cmd (" close" )
59+ child .lua (" vim.cmd('Fyler kind=split_left_most')" )
60+ child .cmd (" close" )
61+
62+ Helpers .expect .layout (child , {
63+ type = " col" ,
64+ children = {
65+ { type = " leaf" , filetype = " fugitive" , buftype = " nowrite" , width = 240 , height = 25 },
66+ {
67+ type = " row" ,
68+ children = {
69+ { type = " leaf" , filetype = " zen-left" , buftype = " nofile" , width = 46 , height = 24 },
70+ { type = " leaf" , filetype = " " , buftype = " " , width = 146 , height = 24 },
71+ { type = " leaf" , filetype = " zen-right" , buftype = " nofile" , width = 46 , height = 24 },
72+ },
73+ },
74+ },
75+ })
76+ end
3977
4078T [" left integration" ][" opening an integration should close the existing integration on the same side" ] = function ()
4179 child .cmd (" Fyler kind=split_left_most" )
@@ -61,6 +99,45 @@ T["left integration"]["opening an integration should close the existing integrat
6199 })
62100end
63101
102+ T [" left integration" ][" opening a left integration preserves an existing bottom integration" ] = function ()
103+ child .cmd (" Trouble diagnostics" )
104+ child .cmd (" Fyler kind=split_left_most" )
105+
106+ Helpers .expect .layout (child , {
107+ type = " col" ,
108+ children = {
109+ {
110+ type = " row" ,
111+ children = {
112+ { type = " leaf" , filetype = " fyler_finder" , buftype = " acwrite" , width = 46 , height = 39 },
113+ { type = " leaf" , filetype = " " , buftype = " " , width = 146 , height = 39 },
114+ { type = " leaf" , filetype = " zen-right" , buftype = " nofile" , width = 46 , height = 39 },
115+ },
116+ },
117+ { type = " leaf" , filetype = " trouble" , buftype = " nofile" , width = 240 , height = 10 },
118+ },
119+ })
120+
121+ child .cmd (" close" )
122+ child .cmd (" Fyler kind=split_left_most" )
123+ child .cmd (" close" )
124+
125+ Helpers .expect .layout (child , {
126+ type = " col" ,
127+ children = {
128+ {
129+ type = " row" ,
130+ children = {
131+ { type = " leaf" , filetype = " zen-left" , buftype = " nofile" , width = 46 , height = 39 },
132+ { type = " leaf" , filetype = " " , buftype = " " , width = 146 , height = 39 },
133+ { type = " leaf" , filetype = " zen-right" , buftype = " nofile" , width = 46 , height = 39 },
134+ },
135+ },
136+ { type = " leaf" , filetype = " trouble" , buftype = " nofile" , width = 240 , height = 10 },
137+ },
138+ })
139+ end
140+
64141T [" top integration" ] = MiniTest .new_set ({})
65142
66143T [" top integration" ][" opening" ] = function ()
@@ -257,9 +334,70 @@ T["right integration"]["opening an integration with table filetype"] = function(
257334 })
258335end
259336
337+ T [" combined" ] = MiniTest .new_set ({})
338+
339+ T [" combined" ][" opening a side integration preserves existing top and bottom integrations" ] = function ()
340+ child .cmd (" Git" )
341+ child .cmd (" Trouble diagnostics" )
342+ child .cmd (" Fyler kind=split_left_most" )
343+
344+ Helpers .expect .layout (child , {
345+ type = " col" ,
346+ children = {
347+ { type = " leaf" , filetype = " fugitive" , buftype = " nowrite" , width = 240 , height = 25 },
348+ {
349+ type = " row" ,
350+ children = {
351+ { type = " leaf" , filetype = " fyler_finder" , buftype = " acwrite" , width = 46 , height = 13 },
352+ { type = " leaf" , filetype = " " , buftype = " " , width = 146 , height = 13 },
353+ { type = " leaf" , filetype = " zen-right" , buftype = " nofile" , width = 46 , height = 13 },
354+ },
355+ },
356+ { type = " leaf" , filetype = " trouble" , buftype = " nofile" , width = 240 , height = 10 },
357+ },
358+ })
359+
360+ child .cmd (" close" )
361+ child .cmd (" Fyler kind=split_left_most" )
362+ child .cmd (" close" )
363+
364+ Helpers .expect .layout (child , {
365+ type = " col" ,
366+ children = {
367+ { type = " leaf" , filetype = " fugitive" , buftype = " nowrite" , width = 240 , height = 25 },
368+ {
369+ type = " row" ,
370+ children = {
371+ { type = " leaf" , filetype = " zen-left" , buftype = " nofile" , width = 46 , height = 13 },
372+ { type = " leaf" , filetype = " " , buftype = " " , width = 146 , height = 13 },
373+ { type = " leaf" , filetype = " zen-right" , buftype = " nofile" , width = 46 , height = 13 },
374+ },
375+ },
376+ { type = " leaf" , filetype = " trouble" , buftype = " nofile" , width = 240 , height = 10 },
377+ },
378+ })
379+
380+ child .cmd (" Trouble close" )
381+
382+ Helpers .expect .layout (child , {
383+ type = " col" ,
384+ children = {
385+ { type = " leaf" , filetype = " fugitive" , buftype = " nowrite" , width = 240 , height = 25 },
386+ {
387+ type = " row" ,
388+ children = {
389+ { type = " leaf" , filetype = " zen-left" , buftype = " nofile" , width = 46 , height = 24 },
390+ { type = " leaf" , filetype = " " , buftype = " " , width = 146 , height = 24 },
391+ { type = " leaf" , filetype = " zen-right" , buftype = " nofile" , width = 46 , height = 24 },
392+ },
393+ },
394+ },
395+ })
396+ end
397+
260398local min_width_child = MiniTest .new_child_neovim ()
261399
262- T [" min_width " ] = MiniTest .new_set ({
400+ T [" min width " ] = MiniTest .new_set ({
263401 hooks = {
264402 pre_case = function ()
265403 min_width_child .restart ({ " -u" , " tests/scripts/init_with_zen_min_width.lua" })
@@ -268,7 +406,7 @@ T["min_width"] = MiniTest.new_set({
268406 },
269407})
270408
271- T [" min_width " ][" integration with a larger min_width should override the wildcard default" ] = function ()
409+ T [" min width " ][" integration with a larger min_width should override the wildcard default" ] = function ()
272410 min_width_child .lua ([[ vim.o.splitright = true; require("CopilotChat").open()]] )
273411
274412 Helpers .expect .layout (min_width_child , {
@@ -281,4 +419,34 @@ T["min_width"]["integration with a larger min_width should override the wildcard
281419 })
282420end
283421
422+ T [" small window integration" ] = MiniTest .new_set ()
423+
424+ T [" small window integration" ][" left integration should keep its natural width" ] = function ()
425+ child .restart ({ " -u" , " tests/scripts/init_with_zen_small.lua" })
426+ child .cmd (" Fyler kind=split_left_most" )
427+
428+ -- Fyler opens at 30% of 140 = 42 cols. Zen must not force it to 0.
429+ Helpers .expect .layout (child , {
430+ type = " row" ,
431+ children = {
432+ { type = " leaf" , filetype = " fyler_finder" , buftype = " acwrite" , width = 42 , height = 50 },
433+ { type = " leaf" , filetype = " " , buftype = " " , width = 97 , height = 50 },
434+ },
435+ })
436+ end
437+
438+ T [" small window integration" ][" right integration should keep its natural width" ] = function ()
439+ child .restart ({ " -u" , " tests/scripts/init_with_zen_small.lua" })
440+ child .cmd (" Neotest summary open" )
441+
442+ -- Neotest opens at vertical resize 50. Zen must not force it to 0.
443+ Helpers .expect .layout (child , {
444+ type = " row" ,
445+ children = {
446+ { type = " leaf" , filetype = " " , buftype = " " , width = 89 , height = 50 },
447+ { type = " leaf" , filetype = " neotest-summary" , buftype = " nofile" , width = 50 , height = 50 },
448+ },
449+ })
450+ end
451+
284452return T
0 commit comments