2013-09-17 22:45:12 -04:00
|
|
|
let g:airline_theme = 'dark'
|
2013-08-30 21:28:38 -04:00
|
|
|
call airline#init#bootstrap()
|
|
|
|
|
|
|
|
describe 'active builder'
|
|
|
|
before
|
|
|
|
let s:builder = airline#builder#new({'active': 1})
|
|
|
|
end
|
|
|
|
|
2013-09-02 14:55:15 -04:00
|
|
|
it 'should start with an empty statusline'
|
2013-08-30 21:28:38 -04:00
|
|
|
let stl = s:builder.build()
|
2013-09-02 14:55:15 -04:00
|
|
|
Expect stl == ''
|
2013-08-30 21:28:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should transition colors from one to the next'
|
|
|
|
call s:builder.add_section('Normal', 'hello')
|
|
|
|
call s:builder.add_section('NonText', 'world')
|
|
|
|
let stl = s:builder.build()
|
|
|
|
Expect stl =~ '%#Normal#hello%#Normal_to_NonText#>%#NonText#world'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should split left/right sections'
|
|
|
|
call s:builder.split()
|
|
|
|
let stl = s:builder.build()
|
|
|
|
Expect stl =~ '%='
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'after split, sections use the right separator'
|
|
|
|
call s:builder.split()
|
|
|
|
call s:builder.add_section('Normal', 'hello')
|
|
|
|
call s:builder.add_section('NonText', 'world')
|
|
|
|
let stl = s:builder.build()
|
|
|
|
Expect stl =~ '%#Normal#hello%#Normal_to_NonText#<%#NonText#world'
|
|
|
|
end
|
2013-09-06 23:06:08 -04:00
|
|
|
|
|
|
|
it 'should not repeat the same highlight group'
|
|
|
|
call s:builder.add_section('Normal', 'hello')
|
|
|
|
call s:builder.add_section('Normal', 'hello')
|
|
|
|
let stl = s:builder.build()
|
|
|
|
Expect stl == '%#Normal#hello>hello'
|
|
|
|
end
|
2013-09-15 22:47:13 -04:00
|
|
|
|
|
|
|
it 'should replace accent groups with the specified group'
|
|
|
|
call s:builder.add_section('Normal', '%#airline_accent_foo#hello')
|
|
|
|
let stl = s:builder.build()
|
|
|
|
Expect stl == '%#Normal#%#Normal_foo#hello'
|
|
|
|
end
|
2013-09-18 21:31:39 -04:00
|
|
|
|
|
|
|
it 'should replace two accent groups with correct groups'
|
|
|
|
call s:builder.add_section('Normal', '%#airline_accent_foo#hello%#airline_accent_bar#world')
|
|
|
|
let stl = s:builder.build()
|
|
|
|
Expect stl =~ '%#Normal_foo#hello%#Normal_bar#world'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should special restore group should go back to previous group'
|
|
|
|
call s:builder.add_section('Normal', '%#__restore__#')
|
|
|
|
let stl = s:builder.build()
|
|
|
|
Expect stl !~ '%#__restore__#'
|
|
|
|
Expect stl =~ '%#Normal#'
|
|
|
|
end
|
2013-08-30 21:28:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'inactive builder'
|
|
|
|
before
|
|
|
|
let s:builder = airline#builder#new({'active': 0})
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should transition colors from one to the next'
|
|
|
|
call s:builder.add_section('Normal', 'hello')
|
|
|
|
call s:builder.add_section('NonText', 'world')
|
|
|
|
let stl = s:builder.build()
|
|
|
|
Expect stl =~ '%#Normal_inactive#hello%#Normal_to_NonText_inactive#>%#NonText_inactive#world'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|