aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/input_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-27 21:27:58 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-04-29 15:51:04 +0800
commit3601cef1377937f01347b20a8c6c303f5f429f51 (patch)
tree95e040f01a48ea9cdb5fe8b46022aa8274b704f9 /test/functional/ui/input_spec.lua
parent4adf2123dd94a3d5303fe200c7e909067e1cda34 (diff)
downloadrneovim-3601cef1377937f01347b20a8c6c303f5f429f51.tar.gz
rneovim-3601cef1377937f01347b20a8c6c303f5f429f51.tar.bz2
rneovim-3601cef1377937f01347b20a8c6c303f5f429f51.zip
feat(mappings): do not replace existing mapping for simplified form
Diffstat (limited to 'test/functional/ui/input_spec.lua')
-rw-r--r--test/functional/ui/input_spec.lua57
1 files changed, 42 insertions, 15 deletions
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 25fc9cdcd1..0f4e97088c 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -173,11 +173,20 @@ describe('input pairs', function()
eq('\t\t', curbuf_contents())
end)
- it('can be mapped', function()
- command('inoremap <tab> TAB!')
- command('inoremap <c-i> CTRL-I!')
- feed('i<tab><c-i><esc>')
- eq('TAB!CTRL-I!', curbuf_contents())
+ describe('can be mapped separately', function()
+ it('if <tab> is mapped after <c-i>', function()
+ command('inoremap <c-i> CTRL-I!')
+ command('inoremap <tab> TAB!')
+ feed('i<tab><c-i><esc>')
+ eq('TAB!CTRL-I!', curbuf_contents())
+ end)
+
+ it('if <tab> is mapped before <c-i>', function()
+ command('inoremap <tab> TAB!')
+ command('inoremap <c-i> CTRL-I!')
+ feed('i<tab><c-i><esc>')
+ eq('TAB!CTRL-I!', curbuf_contents())
+ end)
end)
end)
@@ -187,11 +196,20 @@ describe('input pairs', function()
eq('unos\ndos\ntres', curbuf_contents())
end)
- it('can be mapped', function()
- command('inoremap <c-m> SNIPPET!')
- command('inoremap <cr> , and then<cr>')
- feed('iunos<c-m>dos<cr>tres<esc>')
- eq('unosSNIPPET!dos, and then\ntres', curbuf_contents())
+ describe('can be mapped separately', function()
+ it('if <cr> is mapped after <c-m>', function()
+ command('inoremap <c-m> SNIPPET!')
+ command('inoremap <cr> , and then<cr>')
+ feed('iunos<c-m>dos<cr>tres<esc>')
+ eq('unosSNIPPET!dos, and then\ntres', curbuf_contents())
+ end)
+
+ it('if <cr> is mapped before <c-m>', function()
+ command('inoremap <cr> , and then<cr>')
+ command('inoremap <c-m> SNIPPET!')
+ feed('iunos<c-m>dos<cr>tres<esc>')
+ eq('unosSNIPPET!dos, and then\ntres', curbuf_contents())
+ end)
end)
end)
@@ -201,11 +219,20 @@ describe('input pairs', function()
eq('doubledoublesingle', curbuf_contents())
end)
- it('can be mapped', function()
- command('inoremap <c-[> HALLOJ!')
- command('inoremap <esc> ,<esc>')
- feed('2adubbel<c-[>upp<esc>')
- eq('dubbelHALLOJ!upp,dubbelHALLOJ!upp,', curbuf_contents())
+ describe('can be mapped separately', function()
+ it('if <esc> is mapped after <c-[>', function()
+ command('inoremap <c-[> HALLOJ!')
+ command('inoremap <esc> ,<esc>')
+ feed('2adubbel<c-[>upp<esc>')
+ eq('dubbelHALLOJ!upp,dubbelHALLOJ!upp,', curbuf_contents())
+ end)
+
+ it('if <esc> is mapped before <c-[>', function()
+ command('inoremap <esc> ,<esc>')
+ command('inoremap <c-[> HALLOJ!')
+ feed('2adubbel<c-[>upp<esc>')
+ eq('dubbelHALLOJ!upp,dubbelHALLOJ!upp,', curbuf_contents())
+ end)
end)
end)
end)