diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index a703dbc166..13e93a4764 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -79,8 +79,9 @@ describe('input()', function() ]]) end) it('works correctly with multiple numeric arguments (dict arg)', function() - feed([[:echohl Test | echo input({"prompt": 1, "default": 2, "cancelreturn": 3})]]) - command('redraw!') -- Without this it shows `12` on the line above. + command('echohl Test') + meths.set_var('opts', {prompt=1, default=2, cancelreturn=3}) + feed([[:echo input(opts)]]) screen:expect([[ | {EOB:~ }| @@ -105,6 +106,42 @@ describe('input()', function() {T:3} | ]]) end) + it('works correctly with redraw', function() + command('echohl Test') + meths.set_var('opts', {prompt='Foo>', default='Bar'}) + feed([[:echo inputdialog(opts)]]) + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Bar^ | + ]]) + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Bar^ | + ]]) + feed('') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Ba^ | + ]]) + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Ba^ | + ]]) + end) it('allows omitting everything with dictionary argument', function() command('echohl Test') feed([[:call input({})]]) @@ -209,8 +246,9 @@ describe('inputdialog()', function() ]]) end) it('works correctly with multiple numeric arguments (dict arg)', function() - feed([[:echohl Test | echo inputdialog({"prompt": 1, "default": 2, "cancelreturn": 3})]]) - command('redraw!') -- Without this it shows `12` on the line above. + command('echohl Test') + meths.set_var('opts', {prompt=1, default=2, cancelreturn=3}) + feed([[:echo input(opts)]]) screen:expect([[ | {EOB:~ }| @@ -235,6 +273,42 @@ describe('inputdialog()', function() {T:3} | ]]) end) + it('works correctly with redraw', function() + command('echohl Test') + meths.set_var('opts', {prompt='Foo>', default='Bar'}) + feed([[:echo input(opts)]]) + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Bar^ | + ]]) + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Bar^ | + ]]) + feed('') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Ba^ | + ]]) + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Ba^ | + ]]) + end) it('allows omitting everything with dictionary argument', function() command('echohl Test') feed(':echo inputdialog({})')