aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/tabline_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui/tabline_spec.lua')
-rw-r--r--test/functional/ui/tabline_spec.lua122
1 files changed, 74 insertions, 48 deletions
diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua
index 8f40e1db61..f270d298cb 100644
--- a/test/functional/ui/tabline_spec.lua
+++ b/test/functional/ui/tabline_spec.lua
@@ -12,7 +12,7 @@ describe('ui/ext_tabline', function()
before_each(function()
clear()
screen = Screen.new(25, 5)
- screen:attach({rgb=true, ext_tabline=true})
+ screen:attach({ rgb = true, ext_tabline = true })
function screen:_handle_tabline_update(curtab, tabs, curbuf, buffers)
event_curtab = curtab
event_tabs = tabs
@@ -22,65 +22,77 @@ describe('ui/ext_tabline', function()
end)
it('publishes UI events', function()
- command("tabedit another-tab")
+ command('tabedit another-tab')
local expected_tabs = {
- {tab = { id = 1 }, name = '[No Name]'},
- {tab = { id = 2 }, name = 'another-tab'},
+ { tab = { id = 1 }, name = '[No Name]' },
+ { tab = { id = 2 }, name = 'another-tab' },
}
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
~ |*3
|
- ]], condition=function()
- eq({ id = 2 }, event_curtab)
- eq(expected_tabs, event_tabs)
- end}
+ ]],
+ condition = function()
+ eq({ id = 2 }, event_curtab)
+ eq(expected_tabs, event_tabs)
+ end,
+ }
- command("tabNext")
- screen:expect{grid=[[
+ command('tabNext')
+ screen:expect {
+ grid = [[
^ |
~ |*3
|
- ]], condition=function()
- eq({ id = 1 }, event_curtab)
- eq(expected_tabs, event_tabs)
- end}
+ ]],
+ condition = function()
+ eq({ id = 1 }, event_curtab)
+ eq(expected_tabs, event_tabs)
+ end,
+ }
end)
it('buffer UI events', function()
- local expected_buffers_initial= {
- {buffer = { id = 1 }, name = '[No Name]'},
+ local expected_buffers_initial = {
+ { buffer = { id = 1 }, name = '[No Name]' },
}
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
~ |*3
|
- ]], condition=function()
- eq({ id = 1}, event_curbuf)
- eq(expected_buffers_initial, event_buffers)
- end}
+ ]],
+ condition = function()
+ eq({ id = 1 }, event_curbuf)
+ eq(expected_buffers_initial, event_buffers)
+ end,
+ }
- command("badd another-buffer")
- command("bnext")
+ command('badd another-buffer')
+ command('bnext')
local expected_buffers = {
- {buffer = { id = 1 }, name = '[No Name]'},
- {buffer = { id = 2 }, name = 'another-buffer'},
+ { buffer = { id = 1 }, name = '[No Name]' },
+ { buffer = { id = 2 }, name = 'another-buffer' },
}
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
^ |
~ |*3
|
- ]], condition=function()
- eq({ id = 2 }, event_curbuf)
- eq(expected_buffers, event_buffers)
- end}
+ ]],
+ condition = function()
+ eq({ id = 2 }, event_curbuf)
+ eq(expected_buffers, event_buffers)
+ end,
+ }
end)
end)
-describe("tabline", function()
+describe('tabline', function()
local screen
before_each(function()
@@ -88,27 +100,31 @@ describe("tabline", function()
screen = Screen.new(42, 5)
screen:attach()
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}; -- NonText
- [1] = {reverse = true}; -- TabLineFill
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { reverse = true }, -- TabLineFill
})
end)
it('redraws when tabline option is set', function()
command('set tabline=asdf')
command('set showtabline=2')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:asdf }|
^ |
{0:~ }|*2
|
- ]]}
+ ]],
+ }
command('set tabline=jkl')
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:jkl }|
^ |
{0:~ }|*2
|
- ]]}
+ ]],
+ }
end)
it('click definitions do not leak memory #21765', function()
@@ -123,39 +139,49 @@ describe("tabline", function()
insert('tab2')
command('tabprev')
meths.set_option_value('tabline', '%1T口口%2Ta' .. ('b'):rep(38) .. '%999Xc', {})
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }|
tab^1 |
{0:~ }|*2
|
- ]]}
+ ]],
+ }
assert_alive()
meths.input_mouse('left', 'press', '', 0, 0, 1)
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }|
tab^2 |
{0:~ }|*2
|
- ]]}
+ ]],
+ }
meths.input_mouse('left', 'press', '', 0, 0, 0)
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }|
tab^1 |
{0:~ }|*2
|
- ]]}
+ ]],
+ }
meths.input_mouse('left', 'press', '', 0, 0, 39)
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
{1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }|
tab^2 |
{0:~ }|*2
|
- ]]}
+ ]],
+ }
meths.input_mouse('left', 'press', '', 0, 0, 40)
- screen:expect{grid=[[
+ screen:expect {
+ grid = [[
tab^1 |
{0:~ }|*3
|
- ]]}
+ ]],
+ }
end)
end)