summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-17 19:39:45 +0100
committerw0rp <devw0rp@gmail.com>2018-07-17 19:39:45 +0100
commit7952ebe77ef3f6d5c98ec155ea8aad46652e7077 (patch)
tree3bd5bdbf8287057c189dd5dffc682e9842b25700 /test
parenta01fab2ee6dd827d555792f69fc30443a64dac5f (diff)
downloadale-7952ebe77ef3f6d5c98ec155ea8aad46652e7077.zip
#1700 - Don't send <C-x><C-o> for completion in Insert mode
Diffstat (limited to 'test')
-rw-r--r--test/completion/test_completion_events.vader32
1 files changed, 29 insertions, 3 deletions
diff --git a/test/completion/test_completion_events.vader b/test/completion/test_completion_events.vader
index 504d79c2..f8cf268c 100644
--- a/test/completion/test_completion_events.vader
+++ b/test/completion/test_completion_events.vader
@@ -14,8 +14,8 @@ Before:
runtime autoload/ale/util.vim
- function! ale#util#FeedKeys(string, mode) abort
- call add(g:feedkeys_calls, [a:string, a:mode])
+ function! ale#util#FeedKeys(string) abort
+ call add(g:feedkeys_calls, [a:string])
endfunction
" Pretend we're in insert mode for most tests.
@@ -41,6 +41,7 @@ Before:
After:
Restore
+ unlet! g:output
unlet! g:fake_mode
unlet! g:get_completions_called
unlet! b:ale_old_omnifunc
@@ -155,7 +156,7 @@ Execute(ale#completion#OmniFunc() should set the preview option if it's set):
Execute(ale#completion#Show() should make the correct feedkeys() call):
call ale#completion#Show('Response', 'Parser')
- AssertEqual [["\<C-x>\<C-o>", 'n']], g:feedkeys_calls
+ AssertEqual [["\<Plug>(ale_show_completion_menu)"]], g:feedkeys_calls
Execute(ale#completion#Show() shouldn't do anything if you switch back to normal mode):
let &l:completeopt = 'menu,preview'
@@ -225,3 +226,28 @@ Execute(b:ale_completion_info should be set up correctly when requesting complet
\ 'prefix': 'ab',
\ },
\ b:ale_completion_info
+
+Execute(The correct keybinds should be configured):
+ redir => g:output
+ silent map <Plug>(ale_show_completion_menu)
+ redir END
+
+ AssertEqual
+ \ [
+ \ 'n <Plug>(ale_show_completion_menu) * :call ale#completion#RestoreCompletionOptions()<CR>',
+ \ 'o <Plug>(ale_show_completion_menu) * <Nop>',
+ \ 'v <Plug>(ale_show_completion_menu) * <Nop>',
+ \ ],
+ \ sort(split(g:output, "\n"))
+
+Execute(Running the normal mode <Plug> keybind should reset the settings):
+ let b:ale_old_omnifunc = 'FooBar'
+ let b:ale_old_completopt = 'menu'
+
+ " We can't run the keybind, but we can call the function.
+ call ale#completion#RestoreCompletionOptions()
+
+ AssertEqual 'FooBar', &l:omnifunc
+ AssertEqual 'menu', &l:completeopt
+ Assert !has_key(b:, 'ale_old_omnifunc')
+ Assert !has_key(b:, 'ale_old_completopt')