diff options
Diffstat (limited to 'test/functional/terminal/mouse_spec.lua')
-rw-r--r-- | test/functional/terminal/mouse_spec.lua | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index ecb0b2beb0..29c62d7be7 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -1,11 +1,9 @@ local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') -local clear = helpers.clear +local clear, eq, eval = helpers.clear, helpers.eq, helpers.eval local feed, nvim = helpers.feed, helpers.nvim local feed_data = thelpers.feed_data -if helpers.pending_win32(pending) then return end - describe('terminal mouse', function() local screen @@ -38,31 +36,17 @@ describe('terminal mouse', function() end) describe('when the terminal has focus', function() - it('will exit focus when scrolled', function() - feed('<MouseDown><0,0>') - screen:expect([[ - line23 | - line24 | - line25 | - line26 | - line27 | - ^line28 | - | - ]]) + it('will exit focus on mouse-scroll', function() + eq('t', eval('mode()')) + feed('<ScrollWheelUp><0,0>') + eq('n', eval('mode()')) end) - it('will exit focus after <C-\\>, then scrolled', function() + it('will exit focus on <C-\\> + mouse-scroll', function() + eq('t', eval('mode()')) feed('<C-\\>') - feed('<MouseDown><0,0>') - screen:expect([[ - line23 | - line24 | - line25 | - line26 | - line27 | - ^line28 | - | - ]]) + feed('<ScrollWheelUp><0,0>') + eq('n', eval('mode()')) end) describe('with mouse events enabled by the program', function() @@ -81,6 +65,7 @@ describe('terminal mouse', function() end) it('will forward mouse clicks to the program', function() + if helpers.pending_win32(pending) then return end feed('<LeftMouse><1,2>') screen:expect([[ line27 | @@ -94,7 +79,8 @@ describe('terminal mouse', function() end) it('will forward mouse scroll to the program', function() - feed('<MouseDown><0,0>') + if helpers.pending_win32(pending) then return end + feed('<ScrollWheelUp><0,0>') screen:expect([[ line27 | line28 | @@ -108,6 +94,7 @@ describe('terminal mouse', function() end) describe('with a split window and other buffer', function() + if helpers.pending_win32(pending) then return end before_each(function() feed('<c-\\><c-n>:vsp<cr>') screen:expect([[ @@ -117,7 +104,7 @@ describe('terminal mouse', function() rows: 5, cols: 25 |rows: 5, cols: 25 | {2:^ } |{2: } | ========== ========== | - | + :vsp | ]]) feed(':enew | set number<cr>') screen:expect([[ @@ -164,7 +151,7 @@ describe('terminal mouse', function() end) it('wont lose focus if another window is scrolled', function() - feed('<MouseDown><0,0><MouseDown><0,0>') + feed('<ScrollWheelUp><0,0><ScrollWheelUp><0,0>') screen:expect([[ {7: 21 }line |line30 | {7: 22 }line |rows: 5, cols: 25 | @@ -174,7 +161,7 @@ describe('terminal mouse', function() ========== ========== | {3:-- TERMINAL --} | ]]) - feed('<S-MouseUp><0,0>') + feed('<S-ScrollWheelDown><0,0>') screen:expect([[ {7: 26 }line |line30 | {7: 27 }line |rows: 5, cols: 25 | |