aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-12 16:43:52 -0700
committerJustin M. Keyes <justinkz@gmail.com>2019-09-12 17:04:05 -0700
commit492ac04f7e0ffcc5011d3604b234d149f8b0bb91 (patch)
treec028665f67fc7b9f9d8b576fa8c46157245016d3 /test
parent589f612adfea22b688618fa90e011f5494ca5204 (diff)
downloadrneovim-492ac04f7e0ffcc5011d3604b234d149f8b0bb91.tar.gz
rneovim-492ac04f7e0ffcc5011d3604b234d149f8b0bb91.tar.bz2
rneovim-492ac04f7e0ffcc5011d3604b234d149f8b0bb91.zip
UIEnter/UILeave: fire for embedder UI, builtin TUI
Before this, --embed UIs (without --headless) would not trigger UIEnter. For TUI, maybe UIEnter isn't useful, but: - It is less "surprising"/special. - Makes documentation simpler. - When TUI becomes a coprocess, it will happen anyway.
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/ui_spec.lua14
-rw-r--r--test/functional/terminal/tui_spec.lua27
2 files changed, 34 insertions, 7 deletions
diff --git a/test/functional/api/ui_spec.lua b/test/functional/api/ui_spec.lua
index c5c3185eff..279cd1856d 100644
--- a/test/functional/api/ui_spec.lua
+++ b/test/functional/api/ui_spec.lua
@@ -37,12 +37,14 @@ describe('nvim_ui_attach()', function()
end)
it('autocmds UIEnter/UILeave', function()
- clear{args={
- '--cmd', 'let g:evs = []',
- '--cmd', 'autocmd UIEnter * :call add(g:evs, "UIEnter") | let g:uienter_ev = deepcopy(v:event)',
- '--cmd', 'autocmd UILeave * :call add(g:evs, "UILeave") | let g:uileave_ev = deepcopy(v:event)',
- '--cmd', 'autocmd VimEnter * :call add(g:evs, "VimEnter")',
- }}
+ clear{
+ args_rm={'--headless'},
+ args={
+ '--cmd', 'let g:evs = []',
+ '--cmd', 'autocmd UIEnter * :call add(g:evs, "UIEnter") | let g:uienter_ev = deepcopy(v:event)',
+ '--cmd', 'autocmd UILeave * :call add(g:evs, "UILeave") | let g:uileave_ev = deepcopy(v:event)',
+ '--cmd', 'autocmd VimEnter * :call add(g:evs, "VimEnter")',
+ }}
local screen = Screen.new()
screen:attach()
eq({chan=1}, eval('g:uienter_ev'))
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 725a6db225..c55093cb0f 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -767,11 +767,36 @@ describe('TUI', function()
end)
end)
+describe('TUI UIEnter/UILeave', function()
+ it('fires exactly once, after VimEnter', function()
+ clear()
+ local screen = thelpers.screen_setup(0,
+ '["'..nvim_prog..'", "-u", "NONE", "-i", "NONE"'
+ ..[[, "--cmd", "set noswapfile noshowcmd noruler"]]
+ ..[[, "--cmd", "let g:evs = []"]]
+ ..[[, "--cmd", "autocmd UIEnter * :call add(g:evs, 'UIEnter')"]]
+ ..[[, "--cmd", "autocmd UILeave * :call add(g:evs, 'UILeave')"]]
+ ..[[, "--cmd", "autocmd VimEnter * :call add(g:evs, 'VimEnter')"]]
+ ..']'
+ )
+ feed_data(":echo g:evs\n")
+ screen:expect{grid=[[
+ {1: } |
+ {4:~ }|
+ {4:~ }|
+ {4:~ }|
+ {5:[No Name] }|
+ ['VimEnter', 'UIEnter'] |
+ {3:-- TERMINAL --} |
+ ]]}
+ end)
+end)
+
describe('TUI FocusGained/FocusLost', function()
local screen
before_each(function()
- helpers.clear()
+ clear()
screen = thelpers.screen_setup(0, '["'..nvim_prog
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler"]')
feed_data(":autocmd FocusGained * echo 'gained'\n")