aboutsummaryrefslogtreecommitdiff
path: root/test/functional/autocmd/autocmd_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/autocmd/autocmd_spec.lua')
-rw-r--r--test/functional/autocmd/autocmd_spec.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua
new file mode 100644
index 0000000000..3c813abc2e
--- /dev/null
+++ b/test/functional/autocmd/autocmd_spec.lua
@@ -0,0 +1,31 @@
+local helpers = require('test.functional.helpers')
+
+local clear = helpers.clear
+local command = helpers.command
+local eval = helpers.eval
+
+describe('autocmds:', function()
+ before_each(clear)
+
+ it(':tabnew triggers events in the correct order', function()
+ local expected = {
+ 'WinLeave',
+ 'TabLeave',
+ 'TabNew',
+ 'WinEnter',
+ 'TabEnter',
+ 'BufLeave',
+ 'BufEnter'
+ }
+ command('let g:foo = []')
+ command('autocmd BufEnter * :call add(g:foo, "BufEnter")')
+ command('autocmd BufLeave * :call add(g:foo, "BufLeave")')
+ command('autocmd TabEnter * :call add(g:foo, "TabEnter")')
+ command('autocmd TabLeave * :call add(g:foo, "TabLeave")')
+ command('autocmd TabNew * :call add(g:foo, "TabNew")')
+ command('autocmd WinEnter * :call add(g:foo, "WinEnter")')
+ command('autocmd WinLeave * :call add(g:foo, "WinLeave")')
+ command('tabnew')
+ assert.same(expected, eval('g:foo'))
+ end)
+end)