2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2015-11-17 15:31:22 -07:00
|
|
|
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
|
2014-12-23 07:56:10 -07:00
|
|
|
|
|
|
|
describe('TabNewEntered', function()
|
2016-06-28 02:00:54 -07:00
|
|
|
describe('au TabNewEntered', function()
|
|
|
|
describe('with * as <afile>', function()
|
|
|
|
it('matches when entering any new tab', function()
|
|
|
|
clear()
|
|
|
|
nvim('command', 'au! TabNewEntered * echom "tabnewentered:".tabpagenr().":".bufnr("")')
|
2018-01-05 03:17:21 -07:00
|
|
|
eq("tabnewentered:2:2", nvim('command_output', 'tabnew'))
|
|
|
|
eq("tabnewentered:3:3", nvim('command_output', 'tabnew test.x2'))
|
2016-06-28 02:00:54 -07:00
|
|
|
end)
|
2014-12-23 07:56:10 -07:00
|
|
|
end)
|
2016-06-28 02:00:54 -07:00
|
|
|
describe('with FILE as <afile>', function()
|
|
|
|
it('matches when opening a new tab for FILE', function()
|
2017-01-11 21:08:19 -07:00
|
|
|
nvim('command', 'au! TabNewEntered Xtest-tabnewentered echom "tabnewentered:match"')
|
2018-01-05 03:17:21 -07:00
|
|
|
eq('tabnewentered:4:4\ntabnewentered:match',
|
2017-01-11 21:08:19 -07:00
|
|
|
nvim('command_output', 'tabnew Xtest-tabnewentered'))
|
2016-06-28 02:00:54 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
describe('with CTRL-W T', function()
|
|
|
|
it('works when opening a new tab with CTRL-W T', function()
|
|
|
|
clear()
|
|
|
|
nvim('command', 'au! TabNewEntered * echom "entered"')
|
|
|
|
nvim('command', 'tabnew test.x2')
|
|
|
|
nvim('command', 'split')
|
2018-01-05 03:17:21 -07:00
|
|
|
eq('entered', nvim('command_output', 'execute "normal \\<C-W>T"'))
|
2016-06-28 02:00:54 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
2014-12-23 07:56:10 -07:00
|
|
|
end)
|