Fix failing tests

This commit is contained in:
Christian Brabandt 2017-08-11 12:05:39 +02:00
parent a96681d459
commit 6ee75bdbde
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 8 additions and 0 deletions

View File

@ -81,6 +81,7 @@ function! s:airline_toggle()
if exists("s:stl") if exists("s:stl")
let &stl = s:stl let &stl = s:stl
endif endif
call airline#highlighter#reset_hlcache()
silent doautocmd User AirlineToggledOff silent doautocmd User AirlineToggledOff
else else

View File

@ -19,6 +19,7 @@ describe 'active builder'
end end
it 'should reuse highlight group if background colors match' it 'should reuse highlight group if background colors match'
call airline#highlighter#reset_hlcache()
highlight Foo1 ctermfg=1 ctermbg=2 highlight Foo1 ctermfg=1 ctermbg=2
highlight Foo2 ctermfg=1 ctermbg=2 highlight Foo2 ctermfg=1 ctermbg=2
call s:builder.add_section('Foo1', 'hello') call s:builder.add_section('Foo1', 'hello')
@ -28,6 +29,7 @@ describe 'active builder'
end end
it 'should switch highlight groups if foreground colors differ' it 'should switch highlight groups if foreground colors differ'
call airline#highlighter#reset_hlcache()
highlight Foo1 ctermfg=1 ctermbg=2 highlight Foo1 ctermfg=1 ctermbg=2
highlight Foo2 ctermfg=2 ctermbg=2 highlight Foo2 ctermfg=2 ctermbg=2
call s:builder.add_section('Foo1', 'hello') call s:builder.add_section('Foo1', 'hello')

View File

@ -5,6 +5,7 @@ describe 'themes'
end end
it 'should extract correct colors' it 'should extract correct colors'
call airline#highlighter#reset_hlcache()
highlight Foo ctermfg=1 ctermbg=2 highlight Foo ctermfg=1 ctermbg=2
let colors = airline#themes#get_highlight('Foo') let colors = airline#themes#get_highlight('Foo')
Expect colors[2] == '1' Expect colors[2] == '1'
@ -12,6 +13,7 @@ describe 'themes'
end end
it 'should extract from normal if colors unavailable' it 'should extract from normal if colors unavailable'
call airline#highlighter#reset_hlcache()
highlight Normal ctermfg=100 ctermbg=200 highlight Normal ctermfg=100 ctermbg=200
highlight Foo ctermbg=2 highlight Foo ctermbg=2
let colors = airline#themes#get_highlight('Foo') let colors = airline#themes#get_highlight('Foo')
@ -20,6 +22,7 @@ describe 'themes'
end end
it 'should flip target group if it is reversed' it 'should flip target group if it is reversed'
call airline#highlighter#reset_hlcache()
highlight Foo ctermbg=222 ctermfg=103 term=reverse highlight Foo ctermbg=222 ctermfg=103 term=reverse
let colors = airline#themes#get_highlight('Foo') let colors = airline#themes#get_highlight('Foo')
Expect colors[2] == '222' Expect colors[2] == '222'
@ -27,6 +30,8 @@ describe 'themes'
end end
it 'should pass args through correctly' it 'should pass args through correctly'
call airline#highlighter#reset_hlcache()
hi clear Normal
let hl = airline#themes#get_highlight('Foo', 'bold', 'italic') let hl = airline#themes#get_highlight('Foo', 'bold', 'italic')
Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic'] Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic']