aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-11-30 22:13:50 -0500
committerGitHub <noreply@github.com>2021-11-30 22:13:50 -0500
commit828bf128a64466f254629b102e283af35666cd05 (patch)
tree6cda5c2df8d799d87d86dcfabc595e2737b8feda /test/functional
parent2635b77dba6fa218871441fa3380860405bf9240 (diff)
parent980c68d0362c3ca099c0facef2d08efede76aabf (diff)
downloadrneovim-828bf128a64466f254629b102e283af35666cd05.tar.gz
rneovim-828bf128a64466f254629b102e283af35666cd05.tar.bz2
rneovim-828bf128a64466f254629b102e283af35666cd05.zip
Merge pull request #15840 from vimpostor/vim-8.2.3430
vim-patch:8.2.{3430,3434,3462,3463,3555,3609,3610}: ModeChanged autocmd
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/autocmd/modechanged_spec.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/functional/autocmd/modechanged_spec.lua b/test/functional/autocmd/modechanged_spec.lua
new file mode 100644
index 0000000000..be5a291ac9
--- /dev/null
+++ b/test/functional/autocmd/modechanged_spec.lua
@@ -0,0 +1,31 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
+local feed, command = helpers.feed, helpers.command
+
+describe('ModeChanged', function()
+ before_each(function()
+ clear()
+ command('let g:count = 0')
+ command('au ModeChanged * let g:event = copy(v:event)')
+ command('au ModeChanged * let g:count += 1')
+ end)
+
+ it('picks up terminal mode changes', function()
+ command("term")
+ feed('i')
+ eq({
+ old_mode = 'nt',
+ new_mode = 't'
+ }, eval('g:event'))
+ feed('<c-\\><c-n>')
+ eq({
+ old_mode = 't',
+ new_mode = 'nt'
+ }, eval('g:event'))
+ eq(3, eval('g:count'))
+ command("bd!")
+
+ -- v:event is cleared after the autocommand is done
+ eq({}, eval('v:event'))
+ end)
+end)