diff options
author | James McCoy <jamessan@jamessan.com> | 2016-10-15 15:29:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-15 15:29:53 -0400 |
commit | b268ba353af42d2a2f32e04a17b6acd92f06d31c (patch) | |
tree | d7041ccd96b4b72a99124e486558c97ec2555202 /test | |
parent | 885db120fa51ea5209ed97a4096b756dc998cf05 (diff) | |
parent | 1ebb75b1ec5b22d7c7dba1c7fdc9e7969b81ad4d (diff) | |
download | rneovim-b268ba353af42d2a2f32e04a17b6acd92f06d31c.tar.gz rneovim-b268ba353af42d2a2f32e04a17b6acd92f06d31c.tar.bz2 rneovim-b268ba353af42d2a2f32e04a17b6acd92f06d31c.zip |
Merge pull request #5424 from jamessan/win-tab-nr
api: Support getting the number of a window/tabpage
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/tabpage_spec.lua | 16 | ||||
-rw-r--r-- | test/functional/api/window_spec.lua | 24 |
2 files changed, 40 insertions, 0 deletions
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua index 47dede8b44..90940e9577 100644 --- a/test/functional/api/tabpage_spec.lua +++ b/test/functional/api/tabpage_spec.lua @@ -51,6 +51,22 @@ describe('tabpage_* functions', function() end) end) + describe('get_number', function() + it('works', function() + local tabs = nvim('list_tabpages') + eq(1, tabpage('get_number', tabs[1])) + + nvim('command', 'tabnew') + local tab1, tab2 = unpack(nvim('list_tabpages')) + eq(1, tabpage('get_number', tab1)) + eq(2, tabpage('get_number', tab2)) + + nvim('command', '-tabmove') + eq(2, tabpage('get_number', tab1)) + eq(1, tabpage('get_number', tab2)) + end) + end) + describe('is_valid', function() it('works', function() nvim('command', 'tabnew') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 2c43e4db2c..bf2bf55fb3 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -200,6 +200,30 @@ describe('window_* functions', function() end) end) + describe('get_number', function() + it('works', function() + local wins = nvim('list_wins') + eq(1, window('get_number', wins[1])) + + nvim('command', 'split') + local win1, win2 = unpack(nvim('list_wins')) + eq(1, window('get_number', win1)) + eq(2, window('get_number', win2)) + + nvim('command', 'wincmd J') + eq(2, window('get_number', win1)) + eq(1, window('get_number', win2)) + + nvim('command', 'tabnew') + local win3 = nvim('list_wins')[3] + -- First tab page + eq(2, window('get_number', win1)) + eq(1, window('get_number', win2)) + -- Second tab page + eq(1, window('get_number', win3)) + end) + end) + describe('is_valid', function() it('works', function() nvim('command', 'split') |