aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/float_spec.lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2023-09-27 17:23:42 +0800
committerglepnir <glephunter@gmail.com>2023-09-30 18:30:23 +0800
commit4200a0f1678c06c6da4e4cfb0184c29c1174ed21 (patch)
tree0a76101997ab9b1a13b699abdc65e3f39c8df43c /test/functional/ui/float_spec.lua
parentdfa8b582a64aa22d3c57261bfcdc970b26cb58f3 (diff)
downloadrneovim-4200a0f1678c06c6da4e4cfb0184c29c1174ed21.tar.gz
rneovim-4200a0f1678c06c6da4e4cfb0184c29c1174ed21.tar.bz2
rneovim-4200a0f1678c06c6da4e4cfb0184c29c1174ed21.zip
feat(float): support toggle show float window
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r--test/functional/ui/float_spec.lua126
1 files changed, 122 insertions, 4 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 6db9e7af3e..18c8a7370f 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -1172,14 +1172,14 @@ describe('float window', function()
it('return their configuration', function()
local buf = meths.create_buf(false, false)
local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60})
- local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60}
+ local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false}
eq(expected, meths.win_get_config(win))
- eq({relative='', external=false, focusable=true}, meths.win_get_config(0))
+ eq({relative='', external=false, focusable=true, hide=false}, meths.win_get_config(0))
if multigrid then
meths.win_set_config(win, {external=true, width=10, height=1})
- eq({external=true,focusable=true,width=10,height=1,relative=''}, meths.win_get_config(win))
+ eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, meths.win_get_config(win))
end
end)
@@ -4281,7 +4281,7 @@ describe('float window', function()
|
]]}
end
- eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW',
+ eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW', hide=false,
external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, meths.win_get_config(win))
feed('<c-e>')
@@ -10809,6 +10809,124 @@ describe('float window', function()
]]}
end
end)
+
+ it('float window with hide option', function()
+ local buf = meths.create_buf(false,false)
+ local win = meths.open_win(buf, false, {relative='editor', width=10, height=2, row=2, col=5, hide = true})
+ local expected_pos = {
+ [4]={{id=1001}, 'NW', 1, 2, 5, true},
+ }
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+
+ ## grid 4 (hidden)
+ {1: }|
+ {2:~ }|
+ ]], float_pos = {}}
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+
+ meths.win_set_config(win, {hide = false})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+
+ ## grid 4
+ {1: }|
+ {2:~ }|
+ ]], float_pos = expected_pos}
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }{1: }{0: }|
+ {0:~ }{2:~ }{0: }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+
+ meths.win_set_config(win, {hide=true})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+
+ ## grid 4 (hidden)
+ {1: }|
+ {2:~ }|
+ ]], float_pos = {}}
+ else
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+ end)
end
describe('with ext_multigrid', function()