aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorSeth Fowler <seth@blackhail.net>2019-12-16 14:08:55 -0500
committerBjörn Linse <bjorn.linse@gmail.com>2019-12-16 20:08:55 +0100
commit251b20e5334e1ff8af7fdd37ca1770ad485f031b (patch)
tree132e9c9b77cb33ed92b4792b3018b271c7f246cc /src/nvim/testdir
parent473aea92cb0e987bdd89b4bd27fdc1ed22705bd6 (diff)
downloadrneovim-251b20e5334e1ff8af7fdd37ca1770ad485f031b.tar.gz
rneovim-251b20e5334e1ff8af7fdd37ca1770ad485f031b.tar.bz2
rneovim-251b20e5334e1ff8af7fdd37ca1770ad485f031b.zip
Add support for the pum_getpos() API (#11562)
Add support for the pum_getpos() API
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_popup.vim42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim
index 8083672808..9db6112eeb 100644
--- a/src/nvim/testdir/test_popup.vim
+++ b/src/nvim/testdir/test_popup.vim
@@ -918,6 +918,20 @@ func Test_popup_complete_info_02()
bwipe!
endfunc
+func Test_popup_complete_info_no_pum()
+ new
+ call assert_false( pumvisible() )
+ let no_pum_info = complete_info()
+ let d = {
+ \ 'mode': '',
+ \ 'pum_visible': 0,
+ \ 'items': [],
+ \ 'selected': -1,
+ \ }
+ call assert_equal( d, complete_info() )
+ bwipe!
+endfunc
+
func Test_CompleteChanged()
new
call setline(1, ['foo', 'bar', 'foobar', ''])
@@ -952,4 +966,32 @@ func Test_CompleteChanged()
bw!
endfunc
+function! GetPumPosition()
+ call assert_true( pumvisible() )
+ let g:pum_pos = pum_getpos()
+ return ''
+endfunction
+
+func Test_pum_getpos()
+ new
+ inoremap <buffer><F5> <C-R>=GetPumPosition()<CR>
+ setlocal completefunc=UserDefinedComplete
+
+ let d = {
+ \ 'height': 5,
+ \ 'width': 15,
+ \ 'row': 1,
+ \ 'col': 0,
+ \ 'size': 5,
+ \ 'scrollbar': v:false,
+ \ }
+ call feedkeys("i\<C-X>\<C-U>\<F5>", 'tx')
+ call assert_equal(d, g:pum_pos)
+
+ call assert_false( pumvisible() )
+ call assert_equal( {}, pum_getpos() )
+ bw!
+ unlet g:pum_pos
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab