diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-12-09 08:55:31 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-12-09 08:55:31 -0300 |
commit | c5b9e5d1d317b74d4adf7637cd9081be4ee52722 (patch) | |
tree | 46f2b1692851ae6afe3ffc5d9c2ebc700fe6b452 /test/functional/ui/screen_basic_spec.lua | |
parent | 8bb7aa329d20cb265d8952c96c84a0e54a5726ab (diff) | |
parent | 1192fbd08a054cece0b48dfb695e77e689997980 (diff) | |
download | rneovim-c5b9e5d1d317b74d4adf7637cd9081be4ee52722.tar.gz rneovim-c5b9e5d1d317b74d4adf7637cd9081be4ee52722.tar.bz2 rneovim-c5b9e5d1d317b74d4adf7637cd9081be4ee52722.zip |
Merge PR #1605 'Abstract UI termcap'
Diffstat (limited to 'test/functional/ui/screen_basic_spec.lua')
-rw-r--r-- | test/functional/ui/screen_basic_spec.lua | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua new file mode 100644 index 0000000000..a1110b3231 --- /dev/null +++ b/test/functional/ui/screen_basic_spec.lua @@ -0,0 +1,224 @@ +local helpers = require('test.functional.helpers') +local Screen = require('test.functional.ui.screen') +local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute +local insert = helpers.insert + +describe('Screen', function() + local screen + + before_each(function() + clear() + screen = Screen.new() + screen:attach() + end) + + after_each(function() + screen:detach() + end) + + describe('window', function() + describe('split', function() + it('horizontal', function() + execute('sp') + screen:expect([[ + ^ | + ~ | + ~ | + ~ | + ~ | + ~ | + [No Name] | + | + ~ | + ~ | + ~ | + ~ | + [No Name] | + :sp | + ]]) + end) + + it('horizontal and resize', function() + execute('sp') + execute('resize 8') + screen:expect([[ + ^ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + [No Name] | + | + ~ | + ~ | + [No Name] | + :resize 8 | + ]]) + end) + + it('horizontal and vertical', function() + execute('sp', 'vsp', 'vsp') + screen:expect([[ + ^ | | | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + [No Name] [No Name] [No Name] | + | + ~ | + ~ | + ~ | + ~ | + [No Name] | + | + ]]) + insert('hello') + screen:expect([[ + hell^ |hello |hello | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + [No Name] [+] [No Name] [+] [No Name] [+] | + hello | + ~ | + ~ | + ~ | + ~ | + [No Name] [+] | + | + ]]) + end) + end) + end) + + describe('tabnew', function() + it('creates a new buffer', function() + execute('sp', 'vsp', 'vsp') + insert('hello') + screen:expect([[ + hell^ |hello |hello | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + [No Name] [+] [No Name] [+] [No Name] [+] | + hello | + ~ | + ~ | + ~ | + ~ | + [No Name] [+] | + | + ]]) + execute('tabnew') + insert('hello2') + feed('h') + screen:expect([[ + 4+ [No Name] + [No Name] X| + hell^2 | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + | + ]]) + execute('tabprevious') + screen:expect([[ + 4+ [No Name] + [No Name] X| + hell^ |hello |hello | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + ~ |~ |~ | + [No Name] [+] [No Name] [+] [No Name] [+] | + hello | + ~ | + ~ | + ~ | + [No Name] [+] | + | + ]]) + end) + end) + + describe('insert mode', function() + it('move to next line with <cr>', function() + feed('iline 1<cr>line 2<cr>') + screen:expect([[ + line 1 | + line 2 | + ^ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + -- INSERT -- | + ]]) + end) + end) + + describe('command mode', function() + it('typing commands', function() + feed(':ls') + screen:expect([[ + | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + :ls^ | + ]]) + end) + + it('execute command with multi-line output', function() + feed(':ls<cr>') + screen:expect([[ + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + :ls | + 1 %a "[No Name]" line 1 | + Press ENTER or type command to continue^ | + ]]) + feed('<cr>') -- skip the "Press ENTER..." state or tests will hang + end) + end) +end) |