refactor(tests): use global defaults instead of set_default_attr_ids (2)

This commit is contained in:
bfredl
2024-03-27 10:35:50 +01:00
parent 63f7b1f31e
commit b556bd1a53
30 changed files with 580 additions and 857 deletions

View File

@@ -15,11 +15,6 @@ describe('statusline', function()
end)
it('is updated in cmdline mode when using window-local statusline vim-patch:8.2.2737', function()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[2] = { bold = true, reverse = true }, -- StatusLine
[3] = { reverse = true }, -- StatusLineNC
})
exec([[
setlocal statusline=-%{mode()}-
split
@@ -28,30 +23,25 @@ describe('statusline', function()
screen:expect([[
^ |
{1:~ }|
{2:+n+ }|
{3:+n+ }|
|
{1:~ }|
{3:-n- }|
{2:-n- }|
|
]])
feed(':')
screen:expect([[
|
{1:~ }|
{2:+c+ }|
{3:+c+ }|
|
{1:~ }|
{3:-c- }|
{2:-c- }|
:^ |
]])
end)
it('truncated item does not cause off-by-one highlight vim-patch:8.2.4929', function()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[2] = { foreground = Screen.colors.Blue }, -- User1
[3] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- User2
})
exec([[
set laststatus=2
hi! link User1 Directory
@@ -61,20 +51,13 @@ describe('statusline', function()
screen:expect([[
^ |
{1:~ }|*4
{3:<F}{2:GHI }|
{9:<F}{18:GHI }|
|
]])
end)
-- oldtest: Test_statusline_showcmd()
it('showcmdloc=statusline works', function()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
[2] = { bold = true }, -- MoreMsg
[3] = { bold = true, reverse = true }, -- StatusLine
[5] = { background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue }, -- Folded
})
exec([[
func MyStatusLine()
return '%S'
@@ -92,9 +75,9 @@ describe('statusline', function()
feed('g')
screen:expect([[
{5:+-- 2 lines: a···································}|
{13:+-- 2 lines: a···································}|
^c |
{0:~ }|*3
{1:~ }|*3
{3:g }|
|
]])
@@ -105,19 +88,19 @@ describe('statusline', function()
^a |
b |
c |
{0:~ }|*2
{1:~ }|*2
{3: }|
|
]])
feed('<C-V>Gl')
screen:expect([[
{1:a} |
{1:b} |
{1:c}^ |
{0:~ }|*2
{17:a} |
{17:b} |
{17:c}^ |
{1:~ }|*2
{3:3x2 }|
{2:-- VISUAL BLOCK --} |
{5:-- VISUAL BLOCK --} |
]])
feed('<Esc>1234')
@@ -125,7 +108,7 @@ describe('statusline', function()
a |
b |
^c |
{0:~ }|*2
{1:~ }|*2
{3:1234 }|
|
]])
@@ -137,7 +120,7 @@ describe('statusline', function()
a |
b |
^c |
{0:~ }|*2
{1:~ }|*2
{3:[No Name] [+] 1234 }|
: |
]])