1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
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/ext_tabline', function()
local screen
local event_tabs, event_curtab
before_each(function()
clear()
screen = Screen.new(25, 5)
screen:attach({rgb=true, ext_tabline=true})
screen:set_on_event_handler(function(name, data)
if name == "tabline_update" then
event_curtab, event_tabs = unpack(data)
end
end)
end)
after_each(function()
screen:detach()
end)
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{grid=[[
^ |
~ |
~ |
~ |
|
]], condition=function()
eq({ id = 2 }, event_curtab)
eq(expected_tabs, event_tabs)
end}
command("tabNext")
screen:expect{grid=[[
^ |
~ |
~ |
~ |
|
]], condition=function()
eq({ id = 1 }, event_curtab)
eq(expected_tabs, event_tabs)
end}
end)
end)
|