diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-11 18:44:20 -0700 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-09-12 17:04:05 -0700 |
commit | 6dd56d09025c960ef36952e3d4a1f77779782c52 (patch) | |
tree | 4619033c696a2ea5442e85a1f570ebf223541f86 /test/functional/api/ui_spec.lua | |
parent | e9cf515888705640ebd754483349f2bf84c32255 (diff) | |
download | rneovim-6dd56d09025c960ef36952e3d4a1f77779782c52.tar.gz rneovim-6dd56d09025c960ef36952e3d4a1f77779782c52.tar.bz2 rneovim-6dd56d09025c960ef36952e3d4a1f77779782c52.zip |
UIAttach, UIDetach
doc: ginit.vim, gvimrc
fix #3656
Diffstat (limited to 'test/functional/api/ui_spec.lua')
-rw-r--r-- | test/functional/api/ui_spec.lua | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/test/functional/api/ui_spec.lua b/test/functional/api/ui_spec.lua index bedc381b70..f874fe44a5 100644 --- a/test/functional/api/ui_spec.lua +++ b/test/functional/api/ui_spec.lua @@ -6,7 +6,6 @@ local eval = helpers.eval local meths = helpers.meths local request = helpers.request local pcall_err = helpers.pcall_err -local command = helpers.command describe('nvim_ui_attach()', function() before_each(function() @@ -35,13 +34,23 @@ describe('nvim_ui_attach()', function() eq('UI already attached to channel: 1', pcall_err(request, 'nvim_ui_attach', 40, 10, { rgb=false })) end) - it('autocmds UIAttach/Detach set v:event', function() - local screen = Screen.new() - command('autocmd UIAttach * :let g:ui_attach_v_event = deepcopy(v:event)') - command('autocmd UIDetach * :let g:ui_detach_v_event = deepcopy(v:event)') - screen:attach() - assert.same({chan=1}, eval('g:ui_attach_v_event')) - screen:detach() - assert.same({chan=1}, eval('g:ui_detach_v_event')) - end) +end) + +it('autocmds UIAttach/UIDetach', function() + clear{args={ + '--cmd', 'let g:evs = []', + '--cmd', 'autocmd UIAttach * :call add(g:evs, "UIAttach") | let g:ui_attach_ev = deepcopy(v:event)', + '--cmd', 'autocmd UIDetach * :call add(g:evs, "UIDetach") | let g:ui_detach_ev = deepcopy(v:event)', + '--cmd', 'autocmd VimEnter * :call add(g:evs, "VimEnter")', + }} + local screen = Screen.new() + screen:attach() + eq({chan=1}, eval('g:ui_attach_ev')) + screen:detach() + eq({chan=1}, eval('g:ui_detach_ev')) + eq({ + 'VimEnter', + 'UIAttach', + 'UIDetach', + }, eval('g:evs')) end) |