2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2017-04-08 14:12:26 -07:00
|
|
|
local clear, command, nvim = helpers.clear, helpers.command, helpers.nvim
|
2017-04-08 17:31:13 -07:00
|
|
|
local expect, feed = helpers.expect, helpers.feed
|
2015-10-04 11:54:30 -07:00
|
|
|
local eq, eval = helpers.eq, helpers.eval
|
2015-07-10 15:53:19 -07:00
|
|
|
|
|
|
|
describe(':emenu', function()
|
|
|
|
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('nnoremenu Test.Test inormal<ESC>')
|
|
|
|
command('inoremenu Test.Test insert')
|
|
|
|
command('vnoremenu Test.Test x')
|
|
|
|
command('cnoremenu Test.Test cmdmode')
|
2015-10-04 11:54:30 -07:00
|
|
|
|
2017-04-08 14:12:26 -07:00
|
|
|
command('nnoremenu Edit.Paste p')
|
|
|
|
command('cnoremenu Edit.Paste <C-R>"')
|
2015-07-10 15:53:19 -07:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('executes correct bindings in normal mode without using API', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('emenu Test.Test')
|
2015-07-10 15:53:19 -07:00
|
|
|
expect('normal')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('executes correct bindings in normal mode', function()
|
|
|
|
command('emenu Test.Test')
|
|
|
|
expect('normal')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('executes correct bindings in insert mode', function()
|
|
|
|
feed('i')
|
|
|
|
command('emenu Test.Test')
|
|
|
|
expect('insert')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('executes correct bindings in visual mode', function()
|
|
|
|
feed('iabcde<ESC>0lvll')
|
|
|
|
command('emenu Test.Test')
|
|
|
|
expect('ae')
|
|
|
|
end)
|
|
|
|
|
2015-10-04 11:54:30 -07:00
|
|
|
it('executes correct bindings in command mode', function()
|
2016-06-06 19:01:55 -07:00
|
|
|
feed('ithis is a sentence<esc>^yiwo<esc>')
|
2015-10-04 11:54:30 -07:00
|
|
|
|
|
|
|
-- Invoke "Edit.Paste" in normal-mode.
|
|
|
|
nvim('command', 'emenu Edit.Paste')
|
2015-09-25 17:38:38 -07:00
|
|
|
|
2015-10-04 11:54:30 -07:00
|
|
|
-- Invoke "Edit.Paste" and "Test.Test" in command-mode.
|
|
|
|
feed(':')
|
|
|
|
nvim('command', 'emenu Edit.Paste')
|
|
|
|
nvim('command', 'emenu Test.Test')
|
|
|
|
|
|
|
|
expect([[
|
|
|
|
this is a sentence
|
|
|
|
this]])
|
|
|
|
-- Assert that Edit.Paste pasted @" into the commandline.
|
|
|
|
eq('thiscmdmode', eval('getcmdline()'))
|
|
|
|
end)
|
2015-09-25 17:38:38 -07:00
|
|
|
end)
|