diff options
author | Corey Williamson <euclidianAce@protonmail.com> | 2021-03-09 21:21:45 -0600 |
---|---|---|
committer | Corey Williamson <euclidianAce@protonmail.com> | 2021-03-09 22:51:56 -0600 |
commit | 3a342f9cc9f0ca67620fe0886cdc7a5e03e6fece (patch) | |
tree | 76e81f498971cd9c55dd34ce42d2abcc7408504c /test/functional/api/window_spec.lua | |
parent | cc23c95bccda06c9bbcadd919f4fb2f2545f1151 (diff) | |
download | rneovim-3a342f9cc9f0ca67620fe0886cdc7a5e03e6fece.tar.gz rneovim-3a342f9cc9f0ca67620fe0886cdc7a5e03e6fece.tar.bz2 rneovim-3a342f9cc9f0ca67620fe0886cdc7a5e03e6fece.zip |
api: add vim.api.nvim_win_hide
Diffstat (limited to 'test/functional/api/window_spec.lua')
-rw-r--r-- | test/functional/api/window_spec.lua | 40 |
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) |