diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-05-24 19:18:11 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-05-24 19:18:11 +0000 |
commit | ff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch) | |
tree | 729bbcb92231538fa61dab6c3d890b025484b7f5 /test/functional/terminal/mouse_spec.lua | |
parent | 376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff) | |
parent | 28c04948a1c887a1cc0cb64de79fa32631700466 (diff) | |
download | rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2 rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/terminal/mouse_spec.lua')
-rw-r--r-- | test/functional/terminal/mouse_spec.lua | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index 0395d5ee16..ad98dfc6c3 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -1,10 +1,12 @@ -local helpers = require('test.functional.helpers')(after_each) -local thelpers = require('test.functional.terminal.helpers') -local clear, eq, eval = helpers.clear, helpers.eq, helpers.eval -local feed, api, command = helpers.feed, helpers.api, helpers.command -local feed_data = thelpers.feed_data -local is_os = helpers.is_os -local skip = helpers.skip +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local tt = require('test.functional.terminal.testutil') +local clear, eq, eval = n.clear, t.eq, n.eval +local feed, api, command = n.feed, n.api, n.command +local feed_data = tt.feed_data +local is_os = t.is_os +local skip = t.skip describe(':terminal mouse', function() local screen @@ -15,7 +17,7 @@ describe(':terminal mouse', function() command('highlight StatusLine cterm=NONE') command('highlight StatusLineNC cterm=NONE') command('highlight VertSplit cterm=NONE') - screen = thelpers.screen_setup() + screen = tt.screen_setup() local lines = {} for i = 1, 30 do table.insert(lines, 'line' .. tostring(i)) @@ -41,6 +43,7 @@ describe(':terminal mouse', function() end) it('will exit focus and trigger Normal mode mapping on mouse click', function() + feed([[<C-\><C-N>qri]]) command('let g:got_leftmouse = 0') command('nnoremap <LeftMouse> <Cmd>let g:got_leftmouse = 1<CR>') eq('t', eval('mode(1)')) @@ -48,9 +51,12 @@ describe(':terminal mouse', function() feed('<LeftMouse>') eq('nt', eval('mode(1)')) eq(1, eval('g:got_leftmouse')) + feed('q') + eq('i<LeftMouse>', eval('keytrans(@r)')) end) it('will exit focus and trigger Normal mode mapping on mouse click with modifier', function() + feed([[<C-\><C-N>qri]]) command('let g:got_ctrl_leftmouse = 0') command('nnoremap <C-LeftMouse> <Cmd>let g:got_ctrl_leftmouse = 1<CR>') eq('t', eval('mode(1)')) @@ -58,6 +64,8 @@ describe(':terminal mouse', function() feed('<C-LeftMouse>') eq('nt', eval('mode(1)')) eq(1, eval('g:got_ctrl_leftmouse')) + feed('q') + eq('i<C-LeftMouse>', eval('keytrans(@r)')) end) it('will exit focus on <C-\\> + mouse-scroll', function() @@ -89,8 +97,8 @@ describe(':terminal mouse', function() describe('with mouse events enabled by the program', function() before_each(function() - thelpers.enable_mouse() - thelpers.feed_data('mouse enabled\n') + tt.enable_mouse() + tt.feed_data('mouse enabled\n') screen:expect([[ line27 | line28 | @@ -417,8 +425,8 @@ describe(':terminal mouse', function() ]]) -- enabling mouse won't affect interaction with other windows - thelpers.enable_mouse() - thelpers.feed_data('mouse enabled\n') + tt.enable_mouse() + tt.feed_data('mouse enabled\n') screen:expect([[ {7: 27 }line │line30 | {7: 28 }line │rows: 5, cols: 25 | |