aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/wildmode_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-11-06 20:23:35 +0300
committerZyX <kp-pav@yandex.ru>2017-11-06 20:23:35 +0300
commit24a353364d6d186d528009fd0bb603d87183cf35 (patch)
treea4070dc00731475d6bbdd3c84e61806b33802f7a /test/functional/ui/wildmode_spec.lua
parentf2660bee6aca35be3d0ddb1d225784476c13cd27 (diff)
parent946c2a8ee85830c543e389724575ae531e89b170 (diff)
downloadrneovim-24a353364d6d186d528009fd0bb603d87183cf35.tar.gz
rneovim-24a353364d6d186d528009fd0bb603d87183cf35.tar.bz2
rneovim-24a353364d6d186d528009fd0bb603d87183cf35.zip
Merge branch 'master' into expression-parser
Diffstat (limited to 'test/functional/ui/wildmode_spec.lua')
-rw-r--r--test/functional/ui/wildmode_spec.lua97
1 files changed, 97 insertions, 0 deletions
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 41a751c284..042969357e 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -179,3 +179,100 @@ describe('command line completion', function()
]])
end)
end)
+
+describe('ui/ext_wildmenu', function()
+ local screen
+ local items, selected = nil, nil
+
+ before_each(function()
+ clear()
+ screen = Screen.new(25, 5)
+ screen:attach({rgb=true, ext_wildmenu=true})
+ screen:set_on_event_handler(function(name, data)
+ if name == "wildmenu_show" then
+ items = data[1]
+ elseif name == "wildmenu_select" then
+ selected = data[1]
+ elseif name == "wildmenu_hide" then
+ items, selected = nil, nil
+ end
+ end)
+ end)
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ it('works with :sign <tab>', function()
+ local expected = {
+ 'define',
+ 'jump',
+ 'list',
+ 'place',
+ 'undefine',
+ 'unplace',
+ }
+
+ command('set wildmode=full')
+ command('set wildmenu')
+ feed(':sign <tab>')
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ ~ |
+ :sign define^ |
+ ]], nil, nil, function()
+ eq(expected, items)
+ eq(0, selected)
+ end)
+
+ feed('<tab>')
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ ~ |
+ :sign jump^ |
+ ]], nil, nil, function()
+ eq(expected, items)
+ eq(1, selected)
+ end)
+
+ feed('<left><left>')
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ ~ |
+ :sign ^ |
+ ]], nil, nil, function()
+ eq(expected, items)
+ eq(-1, selected)
+ end)
+
+ feed('<right>')
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ ~ |
+ :sign define^ |
+ ]], nil, nil, function()
+ eq(expected, items)
+ eq(0, selected)
+ end)
+
+ feed('a')
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ ~ |
+ :sign definea^ |
+ ]], nil, nil, function()
+ eq(nil, items)
+ eq(nil, selected)
+ end)
+ end)
+end)