mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local clear, command, eq = helpers.clear, helpers.command, helpers.eq
|
||||
|
||||
describe('ui/tabline', function()
|
||||
describe('ui/ext_tabline', function()
|
||||
local screen
|
||||
local event_tabs, event_curtab
|
||||
|
||||
@@ -21,37 +21,34 @@ describe('ui/tabline', function()
|
||||
screen:detach()
|
||||
end)
|
||||
|
||||
describe('externalized', function()
|
||||
it('publishes UI events', function()
|
||||
command("tabedit another-tab")
|
||||
it('publishes UI events', function()
|
||||
command("tabedit another-tab")
|
||||
|
||||
local expected_tabs = {
|
||||
{tab = { id = 1 }, name = '[No Name]'},
|
||||
{tab = { id = 2 }, name = 'another-tab'},
|
||||
}
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({ id = 2 }, event_curtab)
|
||||
eq(expected_tabs, event_tabs)
|
||||
end)
|
||||
|
||||
command("tabNext")
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({ id = 1 }, event_curtab)
|
||||
eq(expected_tabs, event_tabs)
|
||||
end)
|
||||
local expected_tabs = {
|
||||
{tab = { id = 1 }, name = '[No Name]'},
|
||||
{tab = { id = 2 }, name = 'another-tab'},
|
||||
}
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({ id = 2 }, event_curtab)
|
||||
eq(expected_tabs, event_tabs)
|
||||
end)
|
||||
|
||||
command("tabNext")
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({ id = 1 }, event_curtab)
|
||||
eq(expected_tabs, event_tabs)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -868,7 +868,7 @@ describe('completion', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('ui/externalized/popupmenu', function()
|
||||
describe('ui/ext_popupmenu', function()
|
||||
local screen
|
||||
local items, selected, anchor
|
||||
before_each(function()
|
||||
|
||||
Reference in New Issue
Block a user