diff options
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r-- | test/functional/ui/float_spec.lua | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 9b77cb4014..57ef9bcff6 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -640,8 +640,7 @@ describe('float window', function() end) it('tp_curwin updated if external window is moved into split', function() - local screen = Screen.new(20, 7) - screen:attach { ext_multigrid = true } + local _ = Screen.new(20, 7, { ext_multigrid = true }) command('tabnew') local external_win = api.nvim_open_win(0, true, {external = true, width = 5, height = 5}) @@ -658,8 +657,6 @@ describe('float window', function() command('tabnext') eq(2, fn.tabpagenr()) neq(external_win, api.nvim_get_current_win()) - - screen:detach() end) it('no crash with relative="win" after %bdelete #30569', function() @@ -1018,8 +1015,7 @@ describe('float window', function() local function with_ext_multigrid(multigrid) local screen, attrs before_each(function() - screen = Screen.new(40,7) - screen:attach {ext_multigrid=multigrid} + screen = Screen.new(40,7, {ext_multigrid=multigrid}) attrs = { [0] = {bold=true, foreground=Screen.colors.Blue}, [1] = {background = Screen.colors.LightMagenta}, @@ -1278,7 +1274,7 @@ describe('float window', function() it('return their configuration', function() local buf = api.nvim_create_buf(false, false) local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60}) - local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false} + local expected = {anchor='NW', col=5, external=false, focusable=true, mouse=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false} eq(expected, api.nvim_win_get_config(win)) eq(true, exec_lua([[ local expected, win = ... @@ -1290,11 +1286,11 @@ describe('float window', function() end return true]], expected, win)) - eq({external=false, focusable=true, hide=false, relative='',split="left",width=40,height=6}, api.nvim_win_get_config(0)) + eq({external=false, focusable=true, mouse=true, hide=false, relative='',split="left",width=40,height=6}, api.nvim_win_get_config(0)) if multigrid then api.nvim_win_set_config(win, {external=true, width=10, height=1}) - eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, api.nvim_win_get_config(win)) + eq({external=true,focusable=true,mouse=true,width=10,height=1,relative='',hide=false}, api.nvim_win_get_config(win)) end end) @@ -3988,7 +3984,7 @@ describe('float window', function() ]]} end eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW', hide=false, - external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, api.nvim_win_get_config(win)) + external=false, col=0, row=1, win=firstwin, focusable=true, mouse=true, zindex=50}, api.nvim_win_get_config(win)) feed('<c-e>') if multigrid then @@ -5606,7 +5602,7 @@ describe('float window', function() end end) - it("focus by mouse", function() + local function test_float_mouse_focus() if multigrid then api.nvim_input_mouse('left', 'press', '', 4, 0, 0) screen:expect{grid=[[ @@ -5660,10 +5656,18 @@ describe('float window', function() | ]]) end + end + + it("focus by mouse (focusable=true)", function() + test_float_mouse_focus() end) - it("focus by mouse (focusable=false)", function() - api.nvim_win_set_config(win, {focusable=false}) + it("focus by mouse (focusable=false, mouse=true)", function() + api.nvim_win_set_config(win, {focusable=false, mouse=true}) + test_float_mouse_focus() + end) + + local function test_float_mouse_no_focus() api.nvim_buf_set_lines(0, -1, -1, true, {"a"}) expected_pos[4][6] = false if multigrid then @@ -5721,6 +5725,16 @@ describe('float window', function() | ]]) end + end + + it("focus by mouse (focusable=false)", function() + api.nvim_win_set_config(win, {focusable=false}) + test_float_mouse_no_focus() + end) + + it("focus by mouse (focusable=true, mouse=false)", function() + api.nvim_win_set_config(win, {mouse=false}) + test_float_mouse_no_focus() end) it("j", function() |