diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-06 07:46:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-06 07:46:07 +0800 |
commit | 22205f36a6213f51f211a67444b335f916a2fa9f (patch) | |
tree | 7a0deeb1dbd404b575f3ccdde8003121f2b7f69a /test/functional/ui/screen_basic_spec.lua | |
parent | c8ebb04e92c9646d83110f4b45f1d1dfd5316561 (diff) | |
download | rneovim-22205f36a6213f51f211a67444b335f916a2fa9f.tar.gz rneovim-22205f36a6213f51f211a67444b335f916a2fa9f.tar.bz2 rneovim-22205f36a6213f51f211a67444b335f916a2fa9f.zip |
fix(api): don't change title when setting buffer in a window (#23492)
Diffstat (limited to 'test/functional/ui/screen_basic_spec.lua')
-rw-r--r-- | test/functional/ui/screen_basic_spec.lua | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua index 439021ad87..6b05bd01c2 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear local feed, command = helpers.feed, helpers.command +local curwin = helpers.curwin local insert = helpers.insert local eq = helpers.eq local eval = helpers.eval @@ -189,6 +190,52 @@ local function screen_tests(linegrid) eq(expected, screen.title) end) end) + + it('setting the buffer of another window using RPC', function() + local oldwin = curwin().id + command('split') + meths.win_set_buf(oldwin, buf2) + command('redraw!') + screen:expect(function() + eq(expected, screen.title) + end) + end) + + it('setting the buffer of another window using Lua callback', function() + local oldwin = curwin().id + command('split') + exec_lua(string.format([[ + vim.schedule(function() + vim.api.nvim_win_set_buf(%d, %d) + end) + ]], oldwin, buf2)) + command('redraw!') + screen:expect(function() + eq(expected, screen.title) + end) + end) + + it('creating a floating window using RPC', function() + meths.open_win(buf2, false, { + relative = 'editor', width = 5, height = 5, row = 0, col = 0, + }) + command('redraw!') + screen:expect(function() + eq(expected, screen.title) + end) + end) + + it('creating a floating window using Lua callback', function() + exec_lua(string.format([[ + vim.api.nvim_open_win(%d, false, { + relative = 'editor', width = 5, height = 5, row = 0, col = 0, + }) + ]], buf2)) + command('redraw!') + screen:expect(function() + eq(expected, screen.title) + end) + end) end) end) |