aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/functional/editor/ctrl_c_spec.lua12
-rw-r--r--test/functional/legacy/ex_mode_spec.lua4
-rw-r--r--test/functional/legacy/global_spec.lua6
-rw-r--r--test/functional/legacy/mapping_spec.lua18
4 files changed, 19 insertions, 21 deletions
diff --git a/test/functional/editor/ctrl_c_spec.lua b/test/functional/editor/ctrl_c_spec.lua
index 60131bf2a4..4548e1aa34 100644
--- a/test/functional/editor/ctrl_c_spec.lua
+++ b/test/functional/editor/ctrl_c_spec.lua
@@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, source = helpers.clear, helpers.feed, helpers.source
local command = helpers.command
+local poke_eventloop = helpers.poke_eventloop
local sleep = helpers.sleep
describe("CTRL-C (mapped)", function()
@@ -57,11 +58,9 @@ describe("CTRL-C (mapped)", function()
it('interrupts :sleep', function()
command('nnoremap <C-C> <Nop>')
feed(':sleep 100<CR>')
- -- wait for :sleep to start
- sleep(10)
+ poke_eventloop() -- wait for :sleep to start
feed('foo<C-C>')
- -- wait for input buffer to be flushed
- sleep(10)
+ poke_eventloop() -- wait for input buffer to be flushed
feed('i')
screen:expect([[
^ |
@@ -77,10 +76,9 @@ describe("CTRL-C (mapped)", function()
command('nnoremap <C-C> <Nop>')
command('nmap <F2> <Ignore><F2>')
feed('<F2>')
- sleep(10)
+ sleep(10) -- wait for the key to enter typeahead
feed('foo<C-C>')
- -- wait for input buffer to be flushed
- sleep(10)
+ poke_eventloop() -- wait for input buffer to be flushed
feed('i')
screen:expect([[
^ |
diff --git a/test/functional/legacy/ex_mode_spec.lua b/test/functional/legacy/ex_mode_spec.lua
index a8f54c6939..f21c47e175 100644
--- a/test/functional/legacy/ex_mode_spec.lua
+++ b/test/functional/legacy/ex_mode_spec.lua
@@ -6,7 +6,7 @@ local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
local meths = helpers.meths
-local sleep = helpers.sleep
+local poke_eventloop = helpers.poke_eventloop
before_each(clear)
@@ -143,7 +143,7 @@ describe('Ex mode', function()
^ |
]])
feed('<C-C>')
- sleep(10) -- Wait for input to be flushed
+ poke_eventloop() -- Wait for input to be flushed
feed('foo<CR>')
screen:expect([[
Entering Ex mode. Type "visual" to go to Normal mode. |
diff --git a/test/functional/legacy/global_spec.lua b/test/functional/legacy/global_spec.lua
index 9f4528530c..ff02c41e6c 100644
--- a/test/functional/legacy/global_spec.lua
+++ b/test/functional/legacy/global_spec.lua
@@ -3,7 +3,7 @@ local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local exec = helpers.exec
local feed = helpers.feed
-local sleep = helpers.sleep
+local poke_eventloop = helpers.poke_eventloop
before_each(clear)
@@ -24,7 +24,7 @@ describe(':global', function()
]])
feed(':g/foo/norm :<C-V>;<CR>')
- sleep(10) -- Wait for :sleep to start
+ poke_eventloop() -- Wait for :sleep to start
feed('<C-C>')
screen:expect([[
^foo |
@@ -37,7 +37,7 @@ describe(':global', function()
-- Also test in Ex mode
feed('gQg/foo/norm :<C-V>;<CR>')
- sleep(10) -- Wait for :sleep to start
+ poke_eventloop() -- Wait for :sleep to start
feed('<C-C>')
screen:expect([[
{0: }|
diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua
index 456acc12b5..c1f23ab0a6 100644
--- a/test/functional/legacy/mapping_spec.lua
+++ b/test/functional/legacy/mapping_spec.lua
@@ -131,11 +131,11 @@ describe('mapping', function()
command('set selectmode=mouse')
command('nnoremap <LeftDrag> <LeftDrag><Cmd><CR>')
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'press', '', 0, 0, 0)
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'drag', '', 0, 0, 1)
- sleep(10)
+ poke_eventloop()
eq('s', eval('mode()'))
end)
@@ -144,22 +144,22 @@ describe('mapping', function()
command('inoremap <LeftDrag> <LeftDrag><Cmd>let g:dragged = 1<CR>')
feed('i')
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'press', '', 0, 0, 0)
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'drag', '', 0, 0, 1)
- sleep(10)
+ poke_eventloop()
eq(1, eval('g:dragged'))
eq('v', eval('mode()'))
feed([[<C-\><C-N>]])
command([[inoremap <LeftDrag> <LeftDrag><C-\><C-N>]])
feed('i')
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'press', '', 0, 0, 0)
- sleep(10)
+ poke_eventloop()
meths.input_mouse('left', 'drag', '', 0, 0, 1)
- sleep(10)
+ poke_eventloop()
eq('n', eval('mode()'))
end)