diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-16 15:21:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 15:21:46 +0800 |
commit | cf3b871fa940c42e9c94257118f7d1131ebd362a (patch) | |
tree | 4520fa46d23c21d6a9f24eed5cadd087261b5f1c /test/functional/legacy/mapping_spec.lua | |
parent | a63eea3d238da5c048d0d74e11388425c0c0c3d2 (diff) | |
download | rneovim-cf3b871fa940c42e9c94257118f7d1131ebd362a.tar.gz rneovim-cf3b871fa940c42e9c94257118f7d1131ebd362a.tar.bz2 rneovim-cf3b871fa940c42e9c94257118f7d1131ebd362a.zip |
test: use poke_eventloop() instead of sleep(10) where possible (#19794)
Using sleep(10) to wait for typeahead to finish is flaky, especially on
macOS, where legacy/global_spec.lua has failed several times.
Diffstat (limited to 'test/functional/legacy/mapping_spec.lua')
-rw-r--r-- | test/functional/legacy/mapping_spec.lua | 18 |
1 files changed, 9 insertions, 9 deletions
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) |