aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/embed_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-11-01 12:16:37 +0800
committerGitHub <noreply@github.com>2023-11-01 12:16:37 +0800
commitd7359a87425dc38efda4f74bd580bae9946abe31 (patch)
treeb7537f7e65967d844c150e7ba2f3f7a885b1e012 /test/functional/ui/embed_spec.lua
parent4e6096a67fe9860994be38bcd155e7c47313205e (diff)
downloadrneovim-d7359a87425dc38efda4f74bd580bae9946abe31.tar.gz
rneovim-d7359a87425dc38efda4f74bd580bae9946abe31.tar.bz2
rneovim-d7359a87425dc38efda4f74bd580bae9946abe31.zip
fix(startup): trigger UIEnter for the correct channel (#25860)
Diffstat (limited to 'test/functional/ui/embed_spec.lua')
-rw-r--r--test/functional/ui/embed_spec.lua29
1 files changed, 15 insertions, 14 deletions
diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua
index e75de503ee..fb2cdb3c4a 100644
--- a/test/functional/ui/embed_spec.lua
+++ b/test/functional/ui/embed_spec.lua
@@ -159,19 +159,21 @@ describe('--embed --listen UI', function()
local child_session = helpers.connect(child_server)
- local info_ok, apiinfo = child_session:request('nvim_get_api_info')
- assert(info_ok)
- assert(#apiinfo == 2)
+ local info_ok, api_info = child_session:request('nvim_get_api_info')
+ ok(info_ok)
+ eq(2, #api_info)
+ ok(api_info[1] > 2, 'channel_id > 2', api_info[1])
child_session:request('nvim_exec2', [[
- let g:vim_entered=0
- autocmd VimEnter * call execute("let g:vim_entered=1")
+ let g:evs = []
+ autocmd UIEnter * call add(g:evs, $"UIEnter:{v:event.chan}")
+ autocmd VimEnter * call add(g:evs, "VimEnter")
]], {})
- -- g:vim_entered shouldn't be set to 1 until after attach
- local var_ok, var = child_session:request('nvim_get_var', 'vim_entered')
- assert(var_ok)
- ok(var == 0)
+ -- VimEnter and UIEnter shouldn't be triggered until after attach
+ local var_ok, var = child_session:request('nvim_get_var', 'evs')
+ ok(var_ok)
+ eq({}, var)
local child_screen = Screen.new(40, 6)
child_screen:attach(nil, child_session)
@@ -186,10 +188,9 @@ describe('--embed --listen UI', function()
[1] = {foreground = Screen.colors.Blue, bold = true};
}}
- -- g:vim_entered should now be set to 1
- var_ok, var = child_session:request('nvim_get_var', 'vim_entered')
- assert(var_ok)
- ok(var == 1)
-
+ -- VimEnter and UIEnter should now be triggered
+ var_ok, var = child_session:request('nvim_get_var', 'evs')
+ ok(var_ok)
+ eq({'VimEnter', ('UIEnter:%d'):format(api_info[1])}, var)
end)
end)