aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/window_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-03-28 19:07:56 +0200
committerGitHub <noreply@github.com>2021-03-28 19:07:56 +0200
commit6d4a922e07e857b46d882ea96decce7c7c6e2a30 (patch)
tree04440e96a40cf8e0271d6ee8a20bfb1bc008394f /test/functional/api/window_spec.lua
parent2ed5a776028f50177526a3fe0d7650282316195d (diff)
parent45236981d887e3a535adc0fc1e91cadce54c9463 (diff)
downloadrneovim-6d4a922e07e857b46d882ea96decce7c7c6e2a30.tar.gz
rneovim-6d4a922e07e857b46d882ea96decce7c7c6e2a30.tar.bz2
rneovim-6d4a922e07e857b46d882ea96decce7c7c6e2a30.zip
Merge pull request #14091 from euclidianAce/euclidianAce/nvim_win_hide
api: add vim.api.nvim_win_hide
Diffstat (limited to 'test/functional/api/window_spec.lua')
-rw-r--r--test/functional/api/window_spec.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 7471f50dbd..ceeb84cec9 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -347,4 +347,44 @@ describe('API/win', function()
eq('', funcs.getcmdwintype())
end)
end)
+
+ describe('hide', function()
+ it('can hide current window', function()
+ local oldwin = meths.get_current_win()
+ command('split')
+ local newwin = meths.get_current_win()
+ meths.win_hide(newwin)
+ eq({oldwin}, meths.list_wins())
+ end)
+ it('can hide noncurrent window', function()
+ local oldwin = meths.get_current_win()
+ command('split')
+ local newwin = meths.get_current_win()
+ meths.win_hide(oldwin)
+ eq({newwin}, meths.list_wins())
+ end)
+ it('does not close the buffer', function()
+ local oldwin = meths.get_current_win()
+ local oldbuf = meths.get_current_buf()
+ local buf = meths.create_buf(true, false)
+ local newwin = meths.open_win(buf, true, {
+ relative='win', row=3, col=3, width=12, height=3
+ })
+ meths.win_hide(newwin)
+ eq({oldwin}, meths.list_wins())
+ eq({oldbuf, buf}, meths.list_bufs())
+ end)
+ it('deletes the buffer when bufhidden=wipe', function()
+ local oldwin = meths.get_current_win()
+ local oldbuf = meths.get_current_buf()
+ local buf = meths.create_buf(true, false)
+ local newwin = meths.open_win(buf, true, {
+ relative='win', row=3, col=3, width=12, height=3
+ })
+ meths.buf_set_option(buf, 'bufhidden', 'wipe')
+ meths.win_hide(newwin)
+ eq({oldwin}, meths.list_wins())
+ eq({oldbuf}, meths.list_bufs())
+ end)
+ end)
end)