support for conditional parts. resolves #238.

This commit is contained in:
Bailey Ling
2013-09-08 19:06:57 -04:00
parent 4c6aa4401b
commit 55f524de77
5 changed files with 29 additions and 3 deletions

View File

@@ -25,5 +25,10 @@ describe 'parts'
call airline#parts#define_minwidth('mw', 123)
Expect airline#parts#get('mw').minwidth == 123
end
it 'can define a condition'
call airline#parts#define_condition('part', '1')
Expect airline#parts#get('part').condition == '1'
end
end

View File

@@ -55,5 +55,12 @@ describe 'section'
let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}'])
Expect s == '%t < asdf < %{getcwd()}'
end
it 'should empty out parts that do not pass their condition'
call airline#parts#define_text('conditional', 'conditional')
call airline#parts#define_condition('conditional', '0')
let s = airline#section#create(['conditional'])
Expect s == '%{0 ? airline#util#wrap("conditional",0) : ""}'
end
end