mirror of
https://github.com/neovim/neovim.git
synced 2026-02-02 18:14:30 +00:00
ui: add tests for ui_mode_change
Also fix snapshot_util() to work even if default_attr_ids is not a proper lua array.
This commit is contained in:
@@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen')
|
||||
local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear
|
||||
local feed, execute = helpers.feed, helpers.execute
|
||||
local insert = helpers.insert
|
||||
local eq = helpers.eq
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
@@ -576,4 +577,70 @@ 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)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user