From 3601cef1377937f01347b20a8c6c303f5f429f51 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 27 Apr 2022 21:27:58 +0800 Subject: feat(mappings): do not replace existing mapping for simplified form --- test/functional/ui/input_spec.lua | 57 ++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) (limited to 'test/functional/ui') 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!') - command('inoremap CTRL-I!') - feed('i') - eq('TAB!CTRL-I!', curbuf_contents()) + describe('can be mapped separately', function() + it('if is mapped after ', function() + command('inoremap CTRL-I!') + command('inoremap TAB!') + feed('i') + eq('TAB!CTRL-I!', curbuf_contents()) + end) + + it('if is mapped before ', function() + command('inoremap TAB!') + command('inoremap CTRL-I!') + feed('i') + 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 SNIPPET!') - command('inoremap , and then') - feed('iunosdostres') - eq('unosSNIPPET!dos, and then\ntres', curbuf_contents()) + describe('can be mapped separately', function() + it('if is mapped after ', function() + command('inoremap SNIPPET!') + command('inoremap , and then') + feed('iunosdostres') + eq('unosSNIPPET!dos, and then\ntres', curbuf_contents()) + end) + + it('if is mapped before ', function() + command('inoremap , and then') + command('inoremap SNIPPET!') + feed('iunosdostres') + 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 HALLOJ!') - command('inoremap ,') - feed('2adubbelupp') - eq('dubbelHALLOJ!upp,dubbelHALLOJ!upp,', curbuf_contents()) + describe('can be mapped separately', function() + it('if is mapped after ', function() + command('inoremap HALLOJ!') + command('inoremap ,') + feed('2adubbelupp') + eq('dubbelHALLOJ!upp,dubbelHALLOJ!upp,', curbuf_contents()) + end) + + it('if is mapped before ', function() + command('inoremap ,') + command('inoremap HALLOJ!') + feed('2adubbelupp') + eq('dubbelHALLOJ!upp,dubbelHALLOJ!upp,', curbuf_contents()) + end) end) end) end) -- cgit