2021-11-22 13:40:18 +00:00
|
|
|
-- Copyright (c) 2020-2021 shadmansaleh
|
|
|
|
-- MIT license, see LICENSE for more details.
|
|
|
|
|
|
|
|
local eq = assert.are.same
|
2022-03-05 13:40:36 +00:00
|
|
|
local statusline = require('tests.statusline').new(120, 'active')
|
|
|
|
local inactive_statusline = statusline.new(120, 'inactive')
|
|
|
|
local tabline = statusline.new(120, 'tabline')
|
2021-11-22 13:40:18 +00:00
|
|
|
|
|
|
|
describe('Lualine', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
local config
|
|
|
|
before_each(function()
|
|
|
|
config = {
|
|
|
|
options = {
|
|
|
|
icons_enabled = true,
|
|
|
|
theme = 'gruvbox',
|
|
|
|
component_separators = { left = '', right = '' },
|
|
|
|
section_separators = { left = '', right = '' },
|
|
|
|
disabled_filetypes = {},
|
|
|
|
always_divide_middle = true,
|
2022-03-18 00:59:01 +00:00
|
|
|
globalstatus = false,
|
2022-03-05 13:40:36 +00:00
|
|
|
},
|
|
|
|
sections = {
|
|
|
|
lualine_a = { 'mode' },
|
|
|
|
-- We can't test branch component inside lualines repo.
|
|
|
|
-- As branch name will differ in pr/CI. We could setup a dummy repo
|
|
|
|
-- but plenary doesn't yet support setup() & teardown() so replacing
|
|
|
|
-- branch with a dummy component.
|
|
|
|
lualine_b = {
|
|
|
|
{
|
|
|
|
function()
|
|
|
|
return 'master'
|
|
|
|
end,
|
|
|
|
icon = '',
|
|
|
|
},
|
|
|
|
'diagnostics',
|
2021-11-22 13:40:18 +00:00
|
|
|
},
|
2022-03-05 13:40:36 +00:00
|
|
|
lualine_c = { 'filename' },
|
|
|
|
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
|
|
|
lualine_y = { 'progress' },
|
|
|
|
lualine_z = { 'location' },
|
2021-11-22 13:40:18 +00:00
|
|
|
},
|
2022-03-05 13:40:36 +00:00
|
|
|
inactive_sections = {
|
|
|
|
lualine_a = {},
|
|
|
|
lualine_b = {},
|
|
|
|
lualine_c = { 'filename' },
|
|
|
|
lualine_x = { 'location' },
|
|
|
|
lualine_y = {},
|
|
|
|
lualine_z = {},
|
|
|
|
},
|
|
|
|
tabline = {},
|
|
|
|
extensions = {},
|
|
|
|
}
|
|
|
|
|
|
|
|
vim.opt.swapfile = false
|
2022-01-02 11:38:39 +00:00
|
|
|
vim.cmd('bufdo bdelete')
|
2021-11-22 13:40:18 +00:00
|
|
|
pcall(vim.cmd, 'tabdo tabclose')
|
|
|
|
require('lualine').setup(config)
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('shows active statusline', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_b_normal = { bg = "#504945", fg = "#a89984" }
|
|
|
|
3: lualine_b_normal = { bg = "#504945", fg = "#ebdbb2" }
|
|
|
|
4: lualine_transitional_lualine_b_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#504945" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: NORMAL }
|
|
|
|
{2:}
|
|
|
|
{3: master }
|
|
|
|
{4:}
|
|
|
|
{5: [No Name] }
|
|
|
|
{5: }
|
|
|
|
{5: }
|
|
|
|
{4:}
|
|
|
|
{3: 100% }
|
|
|
|
{2:}
|
|
|
|
{1: 0:1 }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('shows inactive statusline', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
inactive_statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_c_inactive = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: [No Name] }
|
|
|
|
{1: }
|
|
|
|
{1: 0:1 }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('get_config can retrive config', function()
|
|
|
|
eq(config, require('lualine').get_config())
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can live update config', function()
|
|
|
|
local conf = require('lualine').get_config()
|
|
|
|
conf.sections.lualine_a = {}
|
|
|
|
require('lualine').setup(conf)
|
2022-03-05 13:40:36 +00:00
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_b_normal = { bg = "#504945", fg = "#ebdbb2" }
|
|
|
|
2: lualine_transitional_lualine_b_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#504945" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
4: lualine_transitional_lualine_a_normal_to_lualine_b_normal = { bg = "#504945", fg = "#a89984" }
|
|
|
|
5: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
}
|
|
|
|
|{1: master }
|
|
|
|
{2:}
|
|
|
|
{3: [No Name] }
|
|
|
|
{3: }
|
|
|
|
{3: }
|
|
|
|
{2:}
|
|
|
|
{1: 100% }
|
|
|
|
{4:}
|
|
|
|
{5: 0:1 }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('Can work without section separators', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
config.options.section_separators = ''
|
|
|
|
require('lualine').setup(config)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_b_normal = { bg = "#504945", fg = "#ebdbb2" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: NORMAL }
|
|
|
|
{2: master }
|
|
|
|
{3: [No Name] }
|
|
|
|
{3: }
|
|
|
|
{3: }
|
|
|
|
{2: 100% }
|
|
|
|
{1: 0:1 }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('Can work without component_separators', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
table.insert(config.sections.lualine_a, function()
|
2021-11-22 13:40:18 +00:00
|
|
|
return 'test_comp1'
|
|
|
|
end)
|
2022-03-05 13:40:36 +00:00
|
|
|
table.insert(config.sections.lualine_z, function()
|
2021-11-22 13:40:18 +00:00
|
|
|
return 'test_comp2'
|
|
|
|
end)
|
2022-03-05 13:40:36 +00:00
|
|
|
|
|
|
|
require('lualine').setup(config)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_b_normal = { bg = "#504945", fg = "#a89984" }
|
|
|
|
3: lualine_b_normal = { bg = "#504945", fg = "#ebdbb2" }
|
|
|
|
4: lualine_transitional_lualine_b_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#504945" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: NORMAL }
|
|
|
|
{1: test_comp1 }
|
|
|
|
{2:}
|
|
|
|
{3: master }
|
|
|
|
{4:}
|
|
|
|
{5: [No Name] }
|
|
|
|
{5: }
|
|
|
|
{5: }
|
|
|
|
{4:}
|
|
|
|
{3: 100% }
|
|
|
|
{2:}
|
|
|
|
{1: 0:1 }
|
|
|
|
{1: test_comp2 }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
config.options.component_separators = ''
|
|
|
|
require('lualine').setup(config)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_b_normal = { bg = "#504945", fg = "#a89984" }
|
|
|
|
3: lualine_b_normal = { bg = "#504945", fg = "#ebdbb2" }
|
|
|
|
4: lualine_transitional_lualine_b_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#504945" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: NORMAL }
|
|
|
|
{1: test_comp1 }
|
|
|
|
{2:}
|
|
|
|
{3: master }
|
|
|
|
{4:}
|
|
|
|
{5: [No Name] }
|
|
|
|
{5: }
|
|
|
|
{5: }
|
|
|
|
{4:}
|
|
|
|
{3: 100% }
|
|
|
|
{2:}
|
|
|
|
{1: 0:1 }
|
|
|
|
{1: test_comp2 }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('mid divider can be disbled on special case', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
config.options.always_divide_middle = false
|
|
|
|
config.sections.lualine_x = {}
|
|
|
|
config.sections.lualine_y = {}
|
|
|
|
config.sections.lualine_z = {}
|
|
|
|
require('lualine').setup(config)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_b_normal = { bg = "#504945", fg = "#a89984" }
|
|
|
|
3: lualine_b_normal = { bg = "#504945", fg = "#ebdbb2" }
|
|
|
|
4: lualine_transitional_lualine_b_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#504945" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: NORMAL }
|
|
|
|
{2:}
|
|
|
|
{3: master }
|
|
|
|
{4:}
|
|
|
|
{5: [No Name] }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
end)
|
|
|
|
|
2021-12-24 02:03:11 +00:00
|
|
|
it('works with icons disabled', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
config.options.icons_enabled = false
|
|
|
|
config.options.section_separators = ''
|
|
|
|
require('lualine').setup(config)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_b_normal = { bg = "#504945", fg = "#ebdbb2" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: NORMAL }
|
|
|
|
{2: master }
|
|
|
|
{3: [No Name] }
|
|
|
|
{3: }
|
|
|
|
{3: unix }
|
|
|
|
{2: 100% }
|
|
|
|
{1: 0:1 }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
end)
|
|
|
|
|
|
|
|
it('can be desabled for specific filetypes', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
config.options.disabled_filetypes = { 'test_ft' }
|
|
|
|
require('lualine').setup(config)
|
2021-11-22 13:40:18 +00:00
|
|
|
local old_ft = vim.bo.ft
|
|
|
|
vim.bo.ft = 'test_ft'
|
2022-03-05 13:40:36 +00:00
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: StatusLine = { bold = true, reverse = true }
|
|
|
|
}
|
|
|
|
||
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
vim.bo.ft = old_ft
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can apply custom extensions', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
table.insert(config.extensions, {
|
2021-11-22 13:40:18 +00:00
|
|
|
filetypes = { 'test_ft' },
|
|
|
|
sections = {
|
|
|
|
lualine_a = {
|
|
|
|
function()
|
|
|
|
return 'custom_extension_component'
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
local old_ft = vim.bo.ft
|
|
|
|
vim.bo.ft = 'test_ft'
|
2022-03-05 13:40:36 +00:00
|
|
|
require('lualine').setup(config)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: custom_extension_component }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
vim.bo.ft = old_ft
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('same extension can be applied to multiple filetypes', function()
|
2022-03-05 13:40:36 +00:00
|
|
|
table.insert(config.extensions, {
|
2021-11-22 13:40:18 +00:00
|
|
|
filetypes = { 'test_ft1', 'test_ft2' },
|
|
|
|
sections = {
|
|
|
|
lualine_a = {
|
|
|
|
function()
|
|
|
|
return 'custom_extension_component'
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
local old_ft = vim.bo.ft
|
|
|
|
vim.bo.ft = 'test_ft1'
|
2022-03-05 13:40:36 +00:00
|
|
|
require('lualine').setup(config)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: custom_extension_component }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
vim.bo.ft = old_ft
|
2022-03-05 13:40:36 +00:00
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_b_normal = { bg = "#504945", fg = "#a89984" }
|
|
|
|
3: lualine_b_normal = { bg = "#504945", fg = "#ebdbb2" }
|
|
|
|
4: lualine_transitional_lualine_b_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#504945" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: NORMAL }
|
|
|
|
{2:}
|
|
|
|
{3: master }
|
|
|
|
{4:}
|
|
|
|
{5: [No Name] }
|
|
|
|
{5: }
|
|
|
|
{5: }
|
|
|
|
{4:}
|
|
|
|
{3: 100% }
|
|
|
|
{2:}
|
|
|
|
{1: 0:1 }|
|
|
|
|
]===])
|
|
|
|
|
2021-11-22 13:40:18 +00:00
|
|
|
vim.bo.ft = 'test_ft2'
|
2022-03-05 13:40:36 +00:00
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: custom_extension_component }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
2021-11-22 13:40:18 +00:00
|
|
|
vim.bo.ft = old_ft
|
|
|
|
end)
|
|
|
|
|
|
|
|
-- TODO: figure put why some of the tablines tests fail in CI
|
2022-03-05 13:40:36 +00:00
|
|
|
describe('tabline', function()
|
|
|
|
local tab_conf = vim.deepcopy(config)
|
|
|
|
tab_conf.tabline = {
|
|
|
|
lualine_a = {
|
|
|
|
function()
|
|
|
|
return 'tabline_component'
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
lualine_b = {},
|
|
|
|
lualine_c = {},
|
|
|
|
lualine_x = {},
|
|
|
|
lualine_y = {},
|
|
|
|
lualine_z = {},
|
|
|
|
}
|
|
|
|
|
|
|
|
it('can use tabline', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = {
|
|
|
|
function()
|
|
|
|
return 'tabline_component'
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: tabline_component }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can use tabline as statusline', function()
|
|
|
|
local conf = vim.deepcopy(config)
|
|
|
|
conf.tabline = conf.sections
|
|
|
|
conf.sections = {}
|
|
|
|
conf.inactive_sections = {}
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
eq('', vim.go.statusline)
|
|
|
|
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_normal = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_normal_to_lualine_b_normal = { bg = "#504945", fg = "#a89984" }
|
|
|
|
3: lualine_b_normal = { bg = "#504945", fg = "#ebdbb2" }
|
|
|
|
4: lualine_transitional_lualine_b_normal_to_lualine_c_normal = { bg = "#3c3836", fg = "#504945" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: NORMAL }
|
|
|
|
{2:}
|
|
|
|
{3: master }
|
|
|
|
{4:}
|
|
|
|
{5: [No Name] }
|
|
|
|
{5: }
|
|
|
|
{5: }
|
|
|
|
{4:}
|
|
|
|
{3: 100% }
|
|
|
|
{2:}
|
|
|
|
{1: 0:1 }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
describe('tabs component', function()
|
|
|
|
it('works', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = { { 'tabs', max_length = 1e3 } }
|
|
|
|
vim.cmd('tabnew')
|
|
|
|
vim.cmd('tabnew')
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_tabs_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_tabs_inactive_to_lualine_a_tabs_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_tabs_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_tabs_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: 1 }
|
|
|
|
{1: 2 }
|
|
|
|
{2:}
|
|
|
|
{3: 3 }
|
|
|
|
{4:}
|
|
|
|
{5: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
vim.cmd('tabprev')
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_tabs_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_tabs_inactive_to_lualine_a_tabs_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_tabs_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_tabs_active_to_lualine_a_tabs_inactive = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: 1 }
|
|
|
|
{2:}
|
|
|
|
{3: 2 }
|
|
|
|
{4:}
|
|
|
|
{1: 3 }
|
|
|
|
{5: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
vim.cmd('tabprev')
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_tabs_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_tabs_active_to_lualine_a_tabs_inactive = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_a_tabs_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
4: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: 1 }
|
|
|
|
{2:}
|
|
|
|
{3: 2 }
|
|
|
|
{3: 3 }
|
|
|
|
{4: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('mode option can change layout', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = { { 'tabs', max_length = 1e3, mode = 0 } }
|
|
|
|
vim.cmd('tabe ' .. 'a.txt')
|
|
|
|
vim.cmd('tabe ' .. 'b.txt')
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_tabs_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_tabs_inactive_to_lualine_a_tabs_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_tabs_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_tabs_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: 1 }
|
|
|
|
{1: 2 }
|
|
|
|
{2:}
|
|
|
|
{3: 3 }
|
|
|
|
{4:}
|
|
|
|
{5: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_tabs_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_tabs_inactive_to_lualine_a_tabs_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_tabs_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_tabs_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: 1 }
|
|
|
|
{1: 2 }
|
|
|
|
{2:}
|
|
|
|
{3: 3 }
|
|
|
|
{4:}
|
|
|
|
{5: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
conf.tabline.lualine_a = { { 'tabs', max_length = 1e3, mode = 1 } }
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_tabs_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_tabs_inactive_to_lualine_a_tabs_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_tabs_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_tabs_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: [No Name] }
|
|
|
|
{1: a.txt }
|
|
|
|
{2:}
|
|
|
|
{3: b.txt }
|
|
|
|
{4:}
|
|
|
|
{5: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
conf.tabline.lualine_a = { { 'tabs', max_length = 1e3, mode = 2 } }
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_tabs_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_tabs_inactive_to_lualine_a_tabs_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_tabs_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_tabs_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: 1 [No Name] }
|
|
|
|
{1: 2 a.txt }
|
|
|
|
{2:}
|
|
|
|
{3: 3 b.txt }
|
|
|
|
{4:}
|
|
|
|
{5: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('buffers component', function()
|
|
|
|
it('works', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = { { 'buffers', max_length = 1e3, icons_enabled = false } }
|
|
|
|
vim.cmd('tabe ' .. 'a.txt')
|
|
|
|
vim.cmd('tabe ' .. 'b.txt')
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_inactive_to_lualine_a_buffers_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_buffers_active_to_lualine_a_buffers_inactive = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: a.txt }
|
|
|
|
{2:}
|
|
|
|
{3: b.txt }
|
|
|
|
{4:}
|
|
|
|
{1: [No Name] }
|
|
|
|
{5: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
vim.cmd('tabprev')
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_active_to_lualine_a_buffers_inactive = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_a_buffers_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
4: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: a.txt }
|
|
|
|
{2:}
|
|
|
|
{3: b.txt }
|
|
|
|
{3: [No Name] }
|
|
|
|
{4: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
vim.cmd('tabprev')
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_inactive_to_lualine_a_buffers_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_buffers_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: a.txt }
|
|
|
|
{1: b.txt }
|
|
|
|
{2:}
|
|
|
|
{3: [No Name] }
|
|
|
|
{4:}
|
|
|
|
{5: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('mode option can change layout', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = { { 'tabs', max_length = 1e3, mode = 0, icons_enabled = false } }
|
|
|
|
vim.cmd('tabe ' .. 'a.txt')
|
|
|
|
vim.cmd('tabe ' .. 'b.txt')
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_tabs_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_tabs_inactive_to_lualine_a_tabs_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_tabs_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_tabs_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
{MATCH:|{1: %d+ }}
|
|
|
|
{MATCH:{1: %d+ }}
|
|
|
|
{2:}
|
|
|
|
{MATCH:{3: %d+ }}
|
|
|
|
{4:}
|
|
|
|
{MATCH:{5:%s+}|}
|
|
|
|
]===])
|
|
|
|
|
|
|
|
conf.tabline.lualine_a = { { 'buffers', max_length = 1e3, mode = 1, icons_enabled = false } }
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_inactive_to_lualine_a_buffers_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_buffers_active_to_lualine_a_buffers_inactive = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
{MATCH:|{1: %d+ }}
|
|
|
|
{2:}
|
|
|
|
{MATCH:{3: %d+ }}
|
|
|
|
{4:}
|
|
|
|
{MATCH:{1: %d+ }}
|
|
|
|
{MATCH:{5:%s+}|}
|
|
|
|
]===])
|
|
|
|
|
|
|
|
conf.tabline.lualine_a = { { 'buffers', max_length = 1e3, mode = 2, icons_enabled = false } }
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_inactive_to_lualine_a_buffers_active = { bg = "#a89984", fg = "#3c3836" }
|
|
|
|
3: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
4: lualine_transitional_lualine_a_buffers_active_to_lualine_a_buffers_inactive = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
5: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
{MATCH:|{1: %d+ a.txt }}
|
|
|
|
{2:}
|
|
|
|
{MATCH:{3: %d+ b.txt }}
|
|
|
|
{4:}
|
|
|
|
{MATCH:{1: %d+ %[No Name%] }}
|
|
|
|
{MATCH:{5:%s+}|}
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can show modified status', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = { { 'buffers', max_length = 1e3, show_modified_status = true, icons_enabled = false } }
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: [No Name] }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
vim.bo.modified = true
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: [No Name] + }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
|
|
|
vim.bo.modified = false
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can show relative path', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = { { 'buffers', max_length = 1e3, show_filename_only = false, icons_enabled = false } }
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
local path = 'aaaaaa/bbbbb/cccccc/ddddd/eeeee/ffff/gggg'
|
|
|
|
vim.fn.mkdir(path, 'p')
|
|
|
|
vim.cmd('e ' .. path .. '/asdf.txt')
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: a/b/c/d/e/f/g/asdf.txt }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
|
|
|
vim.fn.delete(path:match('(%w+)/.*'), 'rf')
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can show ellipsis when max_width is crossed', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = { { 'buffers', max_length = 1 } }
|
|
|
|
vim.cmd('tabe a.txt')
|
|
|
|
vim.cmd('tabe b.txt')
|
|
|
|
vim.cmd('tabprev')
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_active_to_lualine_a_buffers_inactive = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_a_buffers_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
4: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: a.txt }
|
|
|
|
{2:}
|
|
|
|
{3: ... }
|
|
|
|
{4: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('can show filetype icons', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = { { 'buffers', max_length = 1e3, show_filename_only = false } }
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
vim.cmd('e t.lua')
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_buffers_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_buffers_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: t.lua }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
end)
|
2022-03-26 13:31:40 +00:00
|
|
|
|
|
|
|
describe('windows component', function()
|
|
|
|
it('works', function()
|
|
|
|
local conf = vim.deepcopy(tab_conf)
|
|
|
|
conf.tabline.lualine_a = { { 'windows', max_length = 1e3, mode = 2, icons_enabled = false } }
|
|
|
|
vim.cmd('e ' .. 'a.txt')
|
|
|
|
vim.cmd('tabe ' .. 'b.txt')
|
|
|
|
vim.cmd('vsplit ' .. 'c.txt')
|
|
|
|
vim.cmd('tabe ' .. 'd.txt')
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
require('lualine').statusline()
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_windows_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_windows_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: 1 d.txt }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
vim.cmd('tabprev')
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_windows_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_windows_active_to_lualine_a_windows_inactive = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_a_windows_inactive = { bg = "#3c3836", bold = true, fg = "#a89984" }
|
|
|
|
4: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: 1 c.txt }
|
|
|
|
{2:}
|
|
|
|
{3: 2 b.txt }
|
|
|
|
{4: }|
|
|
|
|
]===])
|
|
|
|
|
|
|
|
vim.cmd('tabprev')
|
|
|
|
tabline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_windows_active = { bg = "#a89984", bold = true, fg = "#282828" }
|
|
|
|
2: lualine_transitional_lualine_a_windows_active_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: 1 a.txt }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
end)
|
2022-03-05 13:40:36 +00:00
|
|
|
end)
|
2022-03-06 02:10:34 +00:00
|
|
|
|
|
|
|
describe('diagnostics', function()
|
|
|
|
local diagnostics_conf = vim.deepcopy(config)
|
|
|
|
diagnostics_conf.sections = {
|
2022-03-06 02:11:19 +00:00
|
|
|
lualine_a = {
|
|
|
|
{
|
|
|
|
'diagnostics',
|
|
|
|
symbols = { error = 'E:', warn = 'W:', info = 'I:', hint = 'H:' },
|
|
|
|
diagnostics_color = {
|
|
|
|
error = { bg = '#a89984', fg = '#ff0000' },
|
|
|
|
warn = { bg = '#a89984', fg = '#ffa500' },
|
|
|
|
info = { bg = '#a89984', fg = '#add8e6' },
|
|
|
|
hint = { bg = '#a89984', fg = '#d3d3d3' },
|
|
|
|
},
|
|
|
|
sources = {
|
|
|
|
function()
|
|
|
|
return {}
|
|
|
|
end,
|
|
|
|
},
|
2022-03-06 02:10:34 +00:00
|
|
|
},
|
2022-03-06 02:11:19 +00:00
|
|
|
},
|
2022-03-06 02:10:34 +00:00
|
|
|
lualine_b = {},
|
|
|
|
lualine_c = {},
|
|
|
|
lualine_x = {},
|
|
|
|
lualine_y = {},
|
|
|
|
lualine_z = {},
|
|
|
|
}
|
|
|
|
|
|
|
|
it('does not show without diagnostics', function()
|
|
|
|
local conf = vim.deepcopy(diagnostics_conf)
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('shows only positive diagnostics', function()
|
|
|
|
local conf = vim.deepcopy(diagnostics_conf)
|
2022-03-06 02:11:19 +00:00
|
|
|
conf.sections.lualine_a[1].sources[1] = function()
|
|
|
|
return { error = 0, warn = 0, info = 1, hint = 0 }
|
|
|
|
end
|
2022-03-06 02:10:34 +00:00
|
|
|
require('lualine').setup(conf)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_diagnostics_info = { bg = "#a89984", fg = "#add8e6" }
|
|
|
|
2: lualine_transitional_lualine_a_diagnostics_info_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
3: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: I:1 }
|
|
|
|
{2:}
|
|
|
|
{3: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('shows all diagnostics with same background', function()
|
|
|
|
local conf = vim.deepcopy(diagnostics_conf)
|
2022-03-06 02:11:19 +00:00
|
|
|
conf.sections.lualine_a[1].sources[1] = function()
|
|
|
|
return { error = 1, warn = 2, info = 3, hint = 4 }
|
|
|
|
end
|
2022-03-06 02:10:34 +00:00
|
|
|
require('lualine').setup(conf)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_diagnostics_error = { bg = "#a89984", fg = "#ff0000" }
|
|
|
|
2: lualine_a_diagnostics_warn = { bg = "#a89984", fg = "#ffa500" }
|
|
|
|
3: lualine_a_diagnostics_info = { bg = "#a89984", fg = "#add8e6" }
|
|
|
|
4: lualine_a_diagnostics_hint = { bg = "#a89984", fg = "#d3d3d3" }
|
|
|
|
5: lualine_transitional_lualine_a_diagnostics_hint_to_lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
6: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: E:1 }
|
|
|
|
{2:W:2 }
|
|
|
|
{3:I:3 }
|
|
|
|
{4:H:4 }
|
|
|
|
{5:}
|
|
|
|
{6: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('shows all diagnostics with padding when background changes', function()
|
|
|
|
local conf = vim.deepcopy(diagnostics_conf)
|
2022-03-06 02:11:19 +00:00
|
|
|
conf.sections.lualine_a[1].sources[1] = function()
|
|
|
|
return { error = 1, warn = 2, info = 3, hint = 4 }
|
|
|
|
end
|
2022-03-06 02:10:34 +00:00
|
|
|
conf.sections.lualine_a[1].diagnostics_color = {
|
2022-03-06 02:11:19 +00:00
|
|
|
error = { bg = '#ff0000', fg = '#a89984' },
|
|
|
|
warn = { bg = '#ffa500', fg = '#a89984' },
|
|
|
|
info = { bg = '#add8e6', fg = '#a89984' },
|
|
|
|
hint = { bg = '#add8e6', fg = '#a89984' },
|
2022-03-06 02:10:34 +00:00
|
|
|
}
|
|
|
|
require('lualine').setup(conf)
|
|
|
|
statusline:expect([===[
|
|
|
|
highlights = {
|
|
|
|
1: lualine_a_diagnostics_error = { bg = "#ff0000", fg = "#a89984" }
|
|
|
|
2: lualine_a_diagnostics_warn = { bg = "#ffa500", fg = "#a89984" }
|
|
|
|
3: lualine_a_diagnostics_info = { bg = "#add8e6", fg = "#a89984" }
|
|
|
|
4: lualine_a_diagnostics_hint = { bg = "#add8e6", fg = "#a89984" }
|
|
|
|
5: lualine_transitional_lualine_a_diagnostics_hint_to_lualine_c_normal = { bg = "#3c3836", fg = "#add8e6" }
|
|
|
|
6: lualine_c_normal = { bg = "#3c3836", fg = "#a89984" }
|
|
|
|
}
|
|
|
|
|{1: E:1 }
|
|
|
|
{2: W:2 }
|
|
|
|
{3: I:3 }
|
|
|
|
{4:H:4 }
|
|
|
|
{5:}
|
|
|
|
{6: }|
|
|
|
|
]===])
|
|
|
|
end)
|
|
|
|
end)
|
2021-11-22 13:40:18 +00:00
|
|
|
end)
|