test: menu_spec: avoid screen test.

Redraw can be flaky especially when remote commands happen during
command-mode. Assert the state directly instead of using Screen.
This commit is contained in:
Justin M. Keyes 2015-10-04 14:54:30 -04:00
parent 8cfcf01475
commit 5a9b2fc1ae

View File

@ -1,9 +1,7 @@
local helpers = require('test.functional.helpers') local helpers = require('test.functional.helpers')
local Screen = require('test.functional.ui.screen').new(40,4)
local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim
local expect = helpers.expect local expect, feed, command = helpers.expect, helpers.feed, helpers.command
local feed = helpers.feed local eq, eval = helpers.eq, helpers.eval
local command = helpers.command
describe(':emenu', function() describe(':emenu', function()
@ -12,6 +10,10 @@ describe(':emenu', function()
execute('nnoremenu Test.Test inormal<ESC>') execute('nnoremenu Test.Test inormal<ESC>')
execute('inoremenu Test.Test insert') execute('inoremenu Test.Test insert')
execute('vnoremenu Test.Test x') execute('vnoremenu Test.Test x')
execute('cnoremenu Test.Test cmdmode')
execute('nnoremenu Edit.Paste p')
execute('cnoremenu Edit.Paste <C-R>"')
end) end)
it('executes correct bindings in normal mode without using API', function() it('executes correct bindings in normal mode without using API', function()
@ -36,26 +38,21 @@ describe(':emenu', function()
expect('ae') expect('ae')
end) end)
end) it('executes correct bindings in command mode', function()
describe('emenu Edit.Paste while in commandline', function()
before_each(function()
clear()
screen = Screen.new(40, 4)
screen:attach()
end)
it('ok', function()
nvim('command', 'runtime menu.vim')
feed('ithis is a sentence<esc>^"+yiwo<esc>') feed('ithis is a sentence<esc>^"+yiwo<esc>')
-- Invoke "Edit.Paste" in normal-mode.
nvim('command', 'emenu Edit.Paste') nvim('command', 'emenu Edit.Paste')
-- Invoke "Edit.Paste" and "Test.Test" in command-mode.
feed(':') feed(':')
nvim('command', 'emenu Edit.Paste') nvim('command', 'emenu Edit.Paste')
screen:expect([[ nvim('command', 'emenu Test.Test')
this is a sentence |
this | expect([[
~ | this is a sentence
:this^ | this]])
]]) -- Assert that Edit.Paste pasted @" into the commandline.
eq('thiscmdmode', eval('getcmdline()'))
end) end)
end) end)