summaryrefslogtreecommitdiff
path: root/test/test_list_opening.vader
diff options
context:
space:
mode:
authorAndrew Crites <ajcrites@gmail.com>2018-03-02 15:22:29 -0500
committerw0rp <w0rp@users.noreply.github.com>2018-03-02 20:22:29 +0000
commitacbe527e15f1f388b8dbc9889216e9368d98e6c6 (patch)
treead72db49a1fc7ef8c3028f2b97819ec76d24b1c2 /test/test_list_opening.vader
parent2096562899aa0994a2c6d2c30320810001d98591 (diff)
downloadale-acbe527e15f1f388b8dbc9889216e9368d98e6c6.zip
Option to open lists vertically (#1381)
* Add configuration option to open lists vertically * Add tests, clean up vertical list config * Vertical list option cleanup * Use is# for tests * Order properties in documentation alphabetically
Diffstat (limited to 'test/test_list_opening.vader')
-rw-r--r--test/test_list_opening.vader51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/test_list_opening.vader b/test/test_list_opening.vader
index 63b30ef1..a24e8de9 100644
--- a/test/test_list_opening.vader
+++ b/test/test_list_opening.vader
@@ -5,6 +5,7 @@ Before:
Save g:ale_open_list
Save g:ale_keep_list_window_open
Save g:ale_list_window_size
+ Save g:ale_list_vertical
Save g:ale_buffer_info
Save g:ale_set_lists_synchronously
@@ -13,6 +14,7 @@ Before:
let g:ale_open_list = 0
let g:ale_keep_list_window_open = 0
let g:ale_list_window_size = 10
+ let g:ale_list_vertical = 0
let g:ale_set_lists_synchronously = 1
let g:loclist = [
@@ -33,16 +35,29 @@ Before:
return 0
endfunction
+ " If the window is vertical, window size should match column size/width
+ function GetQuickfixIsVertical(cols) abort
+ for l:win in range(1, winnr('$'))
+ if getwinvar(l:win, '&buftype') is# 'quickfix'
+ return winwidth(l:win) == a:cols
+ endif
+ endfor
+
+ return 0
+ endfunction
+
After:
Restore
unlet! g:loclist
+ unlet! b:ale_list_vertical
unlet! b:ale_list_window_size
unlet! b:ale_open_list
unlet! b:ale_keep_list_window_open
unlet! b:ale_save_event_fired
delfunction GetQuickfixHeight
+ delfunction GetQuickfixIsVertical
" Close quickfix window after every execute block
lcl
@@ -98,6 +113,24 @@ Execute(The quickfix window height should be correct for the loclist with buffer
AssertEqual 8, GetQuickfixHeight()
+Execute(The quickfix window should be vertical for the loclist with appropriate variables):
+ let g:ale_open_list = 1
+ let b:ale_list_window_size = 8
+ let b:ale_list_vertical = 1
+
+ call ale#list#SetLists(bufnr('%'), g:loclist)
+
+ AssertEqual 1, GetQuickfixIsVertical(b:ale_list_window_size)
+
+Execute(The quickfix window should be horizontal for the loclist with appropriate variables):
+ let g:ale_open_list = 1
+ let b:ale_list_window_size = 8
+ let b:ale_list_vertical = 0
+
+ call ale#list#SetLists(bufnr('%'), g:loclist)
+
+ AssertEqual 0, GetQuickfixIsVertical(b:ale_list_window_size)
+
Execute(The quickfix window should stay open for just the loclist):
let g:ale_open_list = 1
let g:ale_keep_list_window_open = 1
@@ -167,6 +200,24 @@ Execute(The quickfix window height should be correct for the quickfix list with
AssertEqual 8, GetQuickfixHeight()
+Execute(The quickfix window should be vertical for the quickfix with appropriate variables):
+ let g:ale_open_list = 1
+ let b:ale_list_window_size = 8
+ let b:ale_list_vertical = 1
+
+ call ale#list#SetLists(bufnr('%'), g:loclist)
+
+ AssertEqual 1, GetQuickfixIsVertical(b:ale_list_window_size)
+
+Execute(The quickfix window should be horizontal for the quickfix with appropriate variables):
+ let g:ale_open_list = 1
+ let b:ale_list_window_size = 8
+ let b:ale_list_vertical = 0
+
+ call ale#list#SetLists(bufnr('%'), g:loclist)
+
+ AssertEqual 0, GetQuickfixIsVertical(b:ale_list_window_size)
+
Execute(The buffer ale_open_list option should be respected):
let b:ale_open_list = 1