2022-05-21 19:57:01 +00:00
|
|
|
Describe parts.vim
|
|
|
|
|
|
|
|
It overwrItes existing values
|
|
|
|
call airline#parts#define('foo', { 'test': '123' })
|
|
|
|
Assert Equals(airline#parts#get('foo').test, '123')
|
|
|
|
call airline#parts#define('foo', { 'test': '321' })
|
|
|
|
Assert Equals(airline#parts#get('foo').test, '321')
|
|
|
|
End
|
|
|
|
|
|
|
|
It can define a function part
|
|
|
|
call airline#parts#define_function('func', 'bar')
|
|
|
|
Assert Equals(airline#parts#get('func').function, 'bar')
|
|
|
|
End
|
|
|
|
|
|
|
|
It can define a text part
|
|
|
|
call airline#parts#define_text('text', 'bar')
|
|
|
|
Assert Equals(airline#parts#get('text').text, 'bar')
|
|
|
|
End
|
|
|
|
|
|
|
|
It can define a raw part
|
|
|
|
call airline#parts#define_raw('raw', 'bar')
|
|
|
|
Assert Equals(airline#parts#get('raw').raw, 'bar')
|
|
|
|
End
|
|
|
|
|
|
|
|
It can define a minwidth
|
|
|
|
call airline#parts#define_minwidth('mw', 123)
|
|
|
|
Assert Equals(airline#parts#get('mw').minwidth, 123)
|
|
|
|
End
|
|
|
|
|
2022-06-10 17:40:32 +00:00
|
|
|
It can define a condition
|
2022-05-21 19:57:01 +00:00
|
|
|
call airline#parts#define_condition('part', '1')
|
|
|
|
Assert Equals(airline#parts#get('part').condition, '1')
|
|
|
|
End
|
|
|
|
|
2022-06-10 17:40:32 +00:00
|
|
|
It can define a accent
|
2022-05-21 19:57:01 +00:00
|
|
|
call airline#parts#define_accent('part', 'red')
|
|
|
|
Assert Equals(airline#parts#get('part').accent, 'red')
|
|
|
|
End
|
|
|
|
|
2022-06-10 17:40:32 +00:00
|
|
|
It value should be blank
|
2022-05-21 19:57:01 +00:00
|
|
|
Assert Equals(airline#parts#filetype(), '')
|
|
|
|
End
|
|
|
|
|
2022-06-10 17:40:32 +00:00
|
|
|
It can overwrIte a filetype
|
2022-05-21 19:57:01 +00:00
|
|
|
set ft=aaa
|
|
|
|
Assert Equals(airline#parts#filetype(), 'aaa')
|
|
|
|
End
|
|
|
|
|
2022-06-10 17:40:32 +00:00
|
|
|
It can overwrite a filetype
|
2022-05-21 19:57:01 +00:00
|
|
|
"GItHub actions's vim's column is smaller than 90
|
|
|
|
set ft=aaaa
|
|
|
|
if &columns >= 90
|
|
|
|
Assert Equals(airline#parts#filetype(), 'aaaa')
|
|
|
|
else
|
|
|
|
Assert Equals(airline#parts#filetype(), 'aaa…')
|
|
|
|
endif
|
|
|
|
End
|
|
|
|
End
|