diff options
author | Rom Grk <romgrk.cc@gmail.com> | 2020-10-30 14:18:08 -0400 |
---|---|---|
committer | Rom Grk <romgrk.cc@gmail.com> | 2020-10-31 17:29:21 -0400 |
commit | a58d06ebfce8cdbc145948bf6a6177d0e9696709 (patch) | |
tree | 4d88bf995efedd0bb1ac4618baabf80b18943afd | |
parent | d9a58573fd599d006518b403385c4b7333d8d1a0 (diff) | |
download | rneovim-a58d06ebfce8cdbc145948bf6a6177d0e9696709.tar.gz rneovim-a58d06ebfce8cdbc145948bf6a6177d0e9696709.tar.bz2 rneovim-a58d06ebfce8cdbc145948bf6a6177d0e9696709.zip |
tests: separate scroll test for horizontal/vertical scroll
-rw-r--r-- | test/functional/autocmd/winscrolled_spec.lua | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/test/functional/autocmd/winscrolled_spec.lua b/test/functional/autocmd/winscrolled_spec.lua index 534fe3dbcd..646baf08ea 100644 --- a/test/functional/autocmd/winscrolled_spec.lua +++ b/test/functional/autocmd/winscrolled_spec.lua @@ -9,18 +9,34 @@ local source = helpers.source describe('WinScrolled', function() before_each(clear) - it('is triggered by scrolling in normal/visual mode', function() + it('is triggered by scrolling vertically', function() source([[ + set nowrap let width = winwidth(0) - let lines = [repeat('*', width * 2), repeat('*', width * 2)] + let line = '123' . repeat('*', width * 2) + let lines = [line, line] call nvim_buf_set_lines(0, 0, -1, v:true, lines) let g:scrolled = 0 autocmd WinScrolled * let g:scrolled += 1 - normal! zl - normal! <C-e> + execute "normal! \<C-e>" ]]) - eq(2, eval('g:scrolled')) + eq(1, eval('g:scrolled')) + end) + + it('is triggered by scrolling horizontally', function() + source([[ + set nowrap + let width = winwidth(0) + let line = '123' . repeat('*', width * 2) + let lines = [line, line] + call nvim_buf_set_lines(0, 0, -1, v:true, lines) + + let g:scrolled = 0 + autocmd WinScrolled * let g:scrolled += 1 + execute "normal! zl" + ]]) + eq(1, eval('g:scrolled')) end) it('is triggered when the window scrolls in insert mode', function() @@ -33,7 +49,7 @@ describe('WinScrolled', function() autocmd WinScrolled * let g:scrolled += 1 call feedkeys("LA\<CR><Esc>", "n") ]]) - eq(1, eval('g:scrolled')) + eq(2, eval('g:scrolled')) end) it('is triggered when the window is resized', function() |