diff options
author | Rom Grk <romgrk.cc@gmail.com> | 2020-10-30 03:22:52 -0400 |
---|---|---|
committer | Rom Grk <romgrk.cc@gmail.com> | 2020-10-30 03:22:52 -0400 |
commit | d9a58573fd599d006518b403385c4b7333d8d1a0 (patch) | |
tree | 2f45281bfa2a897bd9306c2c731d51798745ec7a | |
parent | e606654ac24f492cf53d696647aee7b0526ed080 (diff) | |
download | rneovim-d9a58573fd599d006518b403385c4b7333d8d1a0.tar.gz rneovim-d9a58573fd599d006518b403385c4b7333d8d1a0.tar.bz2 rneovim-d9a58573fd599d006518b403385c4b7333d8d1a0.zip |
tests: make scroll tests pass
-rw-r--r-- | test/functional/autocmd/scroll_spec.lua | 24 | ||||
-rw-r--r-- | test/functional/autocmd/winscrolled_spec.lua | 8 |
2 files changed, 4 insertions, 28 deletions
diff --git a/test/functional/autocmd/scroll_spec.lua b/test/functional/autocmd/scroll_spec.lua deleted file mode 100644 index f76d80812c..0000000000 --- a/test/functional/autocmd/scroll_spec.lua +++ /dev/null @@ -1,24 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) - -local clear = helpers.clear -local eq = helpers.eq -local eval = helpers.eval -local funcs = helpers.funcs -local source = helpers.source - -describe('Scroll', function() - before_each(clear) - - it('is triggered by scrolling the window', function() - source([[ - let g:scroll = 0 - let g:buf = bufnr('%') - - autocmd scroll * let g:scroll += 1 - - call nvim_buf_set_lines(g:buf, 0, -1, v:true, ['1', '2', '3', '4', '5']) - call feedkeys("\<C-e>", "n") - ]]) - eq(1, eval('g:scroll')) - end) -end) diff --git a/test/functional/autocmd/winscrolled_spec.lua b/test/functional/autocmd/winscrolled_spec.lua index 00160d3771..534fe3dbcd 100644 --- a/test/functional/autocmd/winscrolled_spec.lua +++ b/test/functional/autocmd/winscrolled_spec.lua @@ -12,22 +12,22 @@ describe('WinScrolled', function() it('is triggered by scrolling in normal/visual mode', function() source([[ let width = winwidth(0) - let lines = [repeat('*', range(width * 2))] - call nvim_buf_set_lines(g:buf, 0, -1, v:true, lines) + let lines = [repeat('*', width * 2), repeat('*', width * 2)] + 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> ]]) - eq(1, eval('g:scrolled')) + eq(2, eval('g:scrolled')) end) it('is triggered when the window scrolls in insert mode', function() source([[ let height = winheight(0) let lines = map(range(height * 2), {_, i -> string(i)}) - call nvim_buf_set_lines(g:buf, 0, -1, v:true, lines) + call nvim_buf_set_lines(0, 0, -1, v:true, lines) let g:scrolled = 0 autocmd WinScrolled * let g:scrolled += 1 |