ui: add tests for new cursor shape modes

This commit is contained in:
Björn Linse
2017-04-17 13:32:22 +02:00
parent 9cdbbd4982
commit 2c5751b9b2
5 changed files with 247 additions and 117 deletions

View File

@@ -566,119 +566,6 @@ describe('Screen', function()
end)
end)
describe('mode change', function()
before_each(function()
screen:try_resize(25, 5)
end)
it('works in normal mode', function()
screen:expect([[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
|
]],nil,nil,function ()
eq("normal", screen.mode)
end)
end)
it('works in insert mode', function()
feed('i')
screen:expect([[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- INSERT --} |
]],nil,nil,function ()
eq("insert", screen.mode)
end)
feed('word<esc>')
screen:expect([[
wor^d |
{0:~ }|
{0:~ }|
{0:~ }|
|
]], nil, nil, function ()
eq("normal", screen.mode)
end)
end)
it('works in replace mode', function()
feed('R')
screen:expect([[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- REPLACE --} |
]], nil, nil, function ()
eq("replace", screen.mode)
end)
feed('word<esc>')
screen:expect([[
wor^d |
{0:~ }|
{0:~ }|
{0:~ }|
|
]], nil, nil, function ()
eq("normal", screen.mode)
end)
end)
it('works in cmdline mode', function()
feed(':')
screen:expect([[
|
{0:~ }|
{0:~ }|
{0:~ }|
:^ |
]],nil,nil,function ()
eq("cmdline", screen.mode)
end)
feed('<esc>/')
screen:expect([[
|
{0:~ }|
{0:~ }|
{0:~ }|
/^ |
]],nil,nil,function ()
eq("cmdline", screen.mode)
end)
feed('<esc>?')
screen:expect([[
|
{0:~ }|
{0:~ }|
{0:~ }|
?^ |
]],nil,nil,function ()
eq("cmdline", screen.mode)
end)
feed('<esc>')
screen:expect([[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
|
]],nil,nil,function ()
eq("normal", screen.mode)
end)
end)
end)
it('nvim_ui_attach() handles very large width/height #2180', function()
screen:detach()
screen = Screen.new(999, 999)