diff options
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r-- | test/functional/ui/float_spec.lua | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index f0950959ff..6759510ad1 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -168,6 +168,29 @@ describe('float window', function() eq(7, pos[2]) end) + it('opened with correct position relative to the mouse', function() + meths.input_mouse('left', 'press', '', 0, 10, 10) + local pos = exec_lua([[ + local bufnr = vim.api.nvim_create_buf(false, true) + + local opts = { + width = 10, + height = 10, + col = 1, + row = 2, + relative = 'mouse', + style = 'minimal' + } + + local win_id = vim.api.nvim_open_win(bufnr, false, opts) + + return vim.api.nvim_win_get_position(win_id) + ]]) + + eq(12, pos[1]) + eq(11, pos[2]) + end) + it('opened with correct position relative to the cursor', function() local pos = exec_lua([[ local bufnr = vim.api.nvim_create_buf(false, true) @@ -1350,9 +1373,9 @@ describe('float window', function() [2:----------------------------------------]| [3:----------------------------------------]| ## grid 2 - {20:1}{21: }{19: }{20: }{22:^x}{21: }| - {14:2 }{19: }{14: }{22:y} | - {14:3 }{19: }{14: }{22: } | + {20:1}{19: }{20: }{22:^x}{21: }| + {14:2}{19: }{14: }{22:y} | + {14:3}{19: }{14: }{22: } | {0:~ }| {0:~ }| {0:~ }| @@ -1366,9 +1389,9 @@ describe('float window', function() ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} else screen:expect{grid=[[ - {20:1}{21: }{19: }{20: }{22:^x}{21: }| - {14:2 }{19: }{14: }{22:y} | - {14:3 }{19: }{14: }{22: } {15:x } | + {20:1}{19: }{20: }{22:^x}{21: }| + {14:2}{19: }{14: }{22:y} | + {14:3}{19: }{14: }{22: } {15:x } | {0:~ }{15:y }{0: }| {0:~ }{15: }{0: }| {0:~ }{15: }{0: }| |