Fix cmdline confirmation

This commit is contained in:
hrsh7th
2021-11-05 22:44:43 +09:00
parent d0231d06de
commit 1774ff0f84
7 changed files with 82 additions and 27 deletions

View File

@@ -0,0 +1,39 @@
local spec = require('cmp.utils.spec')
local keymap = require('cmp.utils.keymap')
local feedkeys = require('cmp.utils.feedkeys')
local api = require('cmp.utils.api')
describe('api', function()
describe('get_cursor', function()
before_each(spec.before)
it('insert-mode', function()
feedkeys.call(keymap.t('i\t1234567890'), 'n', function()
assert.are.same(api.get_cursor()[2], 10)
end)
feedkeys.call('', 'nx')
end)
it('cmdline-mode', function()
feedkeys.call(keymap.t(':\t1234567890'), 'n', function()
assert.are.same(api.get_cursor()[2], 10)
end)
feedkeys.call('', 'nx')
end)
end)
describe('get_cursor_before_line', function()
before_each(spec.before)
it('insert-mode', function()
feedkeys.call(keymap.t(':\t1234567890<Left><Left>'), 'n', function()
assert.are.same(api.get_cursor_before_line(), '\t12345678')
end)
feedkeys.call('', 'nx')
end)
it('cmdline-mode', function()
feedkeys.call(keymap.t(':\t1234567890<Left><Left>'), 'n', function()
assert.are.same(api.get_cursor_before_line(), '\t12345678')
end)
feedkeys.call('', 'nx')
end)
end)
end)