mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tests: make scroll tests pass
This commit is contained in:
parent
e606654ac2
commit
d9a58573fd
@ -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)
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user