From f480b38a2f28cda9e8eb2d9aa9430f01a4a7064d Mon Sep 17 00:00:00 2001 From: Joe Hermaszewski Date: Fri, 13 Nov 2015 16:20:32 +0000 Subject: Add tests for focus events --- test/functional/terminal/tui_spec.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index ba0c531c7e..9a1fdfca55 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -148,6 +148,32 @@ describe('tui', function() -- TERMINAL -- | ]]) end) + + it('can handle focus events', function() + execute('autocmd FocusGained * echo "gained"') + execute('autocmd FocusLost * echo "lost"') + feed('\x1b[I') + screen:expect([[ + {1: } | + ~ | + ~ | + ~ | + [No Name] | + gained | + -- TERMINAL -- | + ]]) + + feed('\x1b[O') + screen:expect([[ + {1: } | + ~ | + ~ | + ~ | + [No Name] | + lost | + -- TERMINAL -- | + ]]) + end) end) describe('tui with non-tty file descriptors', function() -- cgit