aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/ui_spec.lua
diff options
context:
space:
mode:
author0x74696d6d79 <34635512+tzx@users.noreply.github.com>2022-06-28 05:53:15 -0400
committerGitHub <noreply@github.com>2022-06-28 02:53:15 -0700
commitee6b21e8430ea810ba2e3e9163b941386a2e1d65 (patch)
tree144e681d0e7fc79107dcbffb91a2eed6bd5a25cf /test/functional/lua/ui_spec.lua
parent014a88799a1d175ad121c520c9cc5bd0bb2d8813 (diff)
downloadrneovim-ee6b21e8430ea810ba2e3e9163b941386a2e1d65.tar.gz
rneovim-ee6b21e8430ea810ba2e3e9163b941386a2e1d65.tar.bz2
rneovim-ee6b21e8430ea810ba2e3e9163b941386a2e1d65.zip
fix(vim.ui.input): accept nil or empty "opts" #19109
Fix #18143
Diffstat (limited to 'test/functional/lua/ui_spec.lua')
-rw-r--r--test/functional/lua/ui_spec.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua
index 2371939204..3fcb2dec8d 100644
--- a/test/functional/lua/ui_spec.lua
+++ b/test/functional/lua/ui_spec.lua
@@ -2,6 +2,8 @@ local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local exec_lua = helpers.exec_lua
local clear = helpers.clear
+local feed = helpers.feed
+local eval = helpers.eval
describe('vim.ui', function()
before_each(function()
@@ -67,5 +69,19 @@ describe('vim.ui', function()
eq('Inputted text', result[1])
eq('Input: ', result[2])
end)
+
+ it('can input text on nil opt', function()
+ feed(':lua vim.ui.input(nil, function(input) result = input end)<cr>')
+ eq('', eval('v:errmsg'))
+ feed('Inputted text<cr>')
+ eq('Inputted text', exec_lua('return result'))
+ end)
+
+ it('can input text on {} opt', function()
+ feed(':lua vim.ui.input({}, function(input) result = input end)<cr>')
+ eq('', eval('v:errmsg'))
+ feed('abcdefg<cr>')
+ eq('abcdefg', exec_lua('return result'))
+ end)
end)
end)