test: mouse_spec

- Use the default buffer text provided by before_each (avoids extra steps and
  makes the tests more consistent with each other)
- Indent
- Adjust help doc
This commit is contained in:
Justin M. Keyes
2016-08-07 23:46:58 -04:00
parent 46492a472a
commit d69194ca8c
2 changed files with 19 additions and 26 deletions

View File

@@ -4399,9 +4399,8 @@ A jump table for the options with a short description can be found at |Q_op|.
*'mousetime'* *'mouset'* *'mousetime'* *'mouset'*
'mousetime' 'mouset' number (default 500) 'mousetime' 'mouset' number (default 500)
global global
Only for GUI, Windows and Unix with xterm. Defines the maximum Defines the maximum time in msec between two mouse clicks for the
time in msec between two mouse clicks for the second click to be second click to be recognized as a multi click.
recognized as a multi click.
*'nrformats'* *'nf'* *'nrformats'* *'nf'*
'nrformats' 'nf' string (default "bin,hex") 'nrformats' 'nf' string (default "bin,hex")

View File

@@ -16,9 +16,9 @@ describe('Mouse input', function()
clear() clear()
meths.set_option('mouse', 'a') meths.set_option('mouse', 'a')
meths.set_option('listchars', 'eol:$') meths.set_option('listchars', 'eol:$')
-- set mouset to very high value to ensure that even in valgrind/travis, -- set mousetime to very high value to ensure that even in valgrind/travis,
-- nvim will still pick multiple clicks -- nvim will still pick multiple clicks
meths.set_option('mouset', 5000) meths.set_option('mousetime', 5000)
screen = Screen.new(25, 5) screen = Screen.new(25, 5)
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
@@ -65,24 +65,20 @@ describe('Mouse input', function()
end) end)
it('double left click enters visual mode', function() it('double left click enters visual mode', function()
execute('%delete')
insert('foo')
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
feed('<LeftRelease><0,0>') feed('<LeftRelease><0,0>')
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
feed('<LeftRelease><0,0>') feed('<LeftRelease><0,0>')
screen:expect([[ screen:expect([[
{1:fo}^o | {1:testin}^g |
~ | mouse |
~ | support and selection |
~ | ~ |
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])
end) end)
it('triple left click enters visual line mode', function() it('triple left click enters visual line mode', function()
execute('%delete')
insert('foo')
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
feed('<LeftRelease><0,0>') feed('<LeftRelease><0,0>')
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
@@ -90,17 +86,15 @@ describe('Mouse input', function()
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
feed('<LeftRelease><0,0>') feed('<LeftRelease><0,0>')
screen:expect([[ screen:expect([[
^f{1:oo}{3: } | ^t{1:esting}{3: } |
~ | mouse |
~ | support and selection |
~ | ~ |
{2:-- VISUAL LINE --} | {2:-- VISUAL LINE --} |
]]) ]])
end) end)
it('quadruple left click enters visual block mode', function() it('quadruple left click enters visual block mode', function()
execute('%delete')
insert('foo')
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
feed('<LeftRelease><0,0>') feed('<LeftRelease><0,0>')
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
@@ -110,9 +104,9 @@ describe('Mouse input', function()
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
feed('<LeftRelease><0,0>') feed('<LeftRelease><0,0>')
screen:expect([[ screen:expect([[
^foo | ^testing |
~ | mouse |
~ | support and selection |
~ | ~ |
{2:-- VISUAL BLOCK --} | {2:-- VISUAL BLOCK --} |
]]) ]])