diff options
author | Joe Hermaszewski <git@monoid.al> | 2015-11-20 23:09:30 +0000 |
---|---|---|
committer | Marco Hinz <mh.codebro@gmail.com> | 2015-11-23 13:18:27 +0100 |
commit | 6329fd420eec1f1325be2131726e82e23da3e90b (patch) | |
tree | d57b9ccf05ca0f910f6af2fbcc95d04e5e523caf | |
parent | 442cd0672b567cce56dd45e731ec1cc3b71b7cf4 (diff) | |
download | rneovim-6329fd420eec1f1325be2131726e82e23da3e90b.tar.gz rneovim-6329fd420eec1f1325be2131726e82e23da3e90b.tar.bz2 rneovim-6329fd420eec1f1325be2131726e82e23da3e90b.zip |
Reorganize focus events test into individual tests
The focus event tests now live in their own `describe` block with each
test testing the handling of focus events in a single mode.
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 92cd9567d2..3c79bc1fdb 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -149,13 +149,41 @@ describe('tui', function() -- TERMINAL -- | ]]) end) +end) - it('can handle focus events', function() - execute('set noshowmode') +describe('tui with non-tty file descriptors', function() + before_each(helpers.clear) + + after_each(function() + os.remove('testF') -- ensure test file is removed + end) + + it('can handle pipes as stdout and stderr', function() + local screen = thelpers.screen_setup(0, '"'..helpers.nvim_prog..' -u NONE -i NONE --cmd \'set noswapfile\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"') + screen:set_default_attr_ids({}) + screen:set_default_attr_ignore(true) + feed(':w testF\n:q\n') + screen:expect([[ + :w testF | + :q | + abc | + | + [Process exited 0] | + | + -- TERMINAL -- | + ]]) + end) +end) + +describe('tui focus event handling', function() + before_each(function() + helpers.clear() + screen = thelpers.screen_setup(0, '["'..helpers.nvim_prog..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]') execute('autocmd FocusGained * echo "gained"') execute('autocmd FocusLost * echo "lost"') + end) - -- In normal mode + it('can handle focus events in normal mode', function() feed('\x1b[I') screen:expect([[ {1: } | @@ -177,8 +205,10 @@ describe('tui', function() lost | -- TERMINAL -- | ]]) + end) - -- In insert mode + it('can handle focus events in insert mode', function() + execute('set noshowmode') feed('i') feed('\x1b[I') screen:expect([[ @@ -200,9 +230,9 @@ describe('tui', function() lost | -- TERMINAL -- | ]]) + end) - -- In command-line mode - feed('\x1b') + it('can handle focus events in cmdline mode', function() feed(':') feed('\x1b[I') screen:expect([[ @@ -224,11 +254,12 @@ describe('tui', function() l{1:o}st | -- TERMINAL -- | ]]) + end) - -- In terminal mode + it('can handle focus events in terminal mode', function() execute('set shell='..nvim_dir..'/shell-test') execute('set laststatus=0') - feed('\x1b') + execute('set noshowmode') execute('terminal') feed('\x1b[I') screen:expect([[ @@ -252,27 +283,3 @@ describe('tui', function() ]]) end) end) - -describe('tui with non-tty file descriptors', function() - before_each(helpers.clear) - - after_each(function() - os.remove('testF') -- ensure test file is removed - end) - - it('can handle pipes as stdout and stderr', function() - local screen = thelpers.screen_setup(0, '"'..helpers.nvim_prog..' -u NONE -i NONE --cmd \'set noswapfile\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"') - screen:set_default_attr_ids({}) - screen:set_default_attr_ignore(true) - feed(':w testF\n:q\n') - screen:expect([[ - :w testF | - :q | - abc | - | - [Process exited 0] | - | - -- TERMINAL -- | - ]]) - end) -end) |