diff options
author | James McCoy <jamessan@jamessan.com> | 2018-03-28 21:52:06 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2018-03-28 21:54:39 -0400 |
commit | 79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1 (patch) | |
tree | 4e0589d75801f3ff6a9678f84f5009102766661e /test/functional/ui/options_spec.lua | |
parent | 4403864da3c48412595d439f36458d1e6ccfc49f (diff) | |
parent | 3f3de9b1a95d273463a87516365510dbffcaf3d2 (diff) | |
download | rneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.tar.gz rneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.tar.bz2 rneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.zip |
Merge branch 'master' into yagebu/option-fixes
Diffstat (limited to 'test/functional/ui/options_spec.lua')
-rw-r--r-- | test/functional/ui/options_spec.lua | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua new file mode 100644 index 0000000000..62b08c0967 --- /dev/null +++ b/test/functional/ui/options_spec.lua @@ -0,0 +1,110 @@ +local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') +local clear = helpers.clear +local command = helpers.command +local eq = helpers.eq + +describe('ui receives option updates', function() + local screen + + before_each(function() + clear() + screen = Screen.new(20,5) + end) + + after_each(function() + screen:detach() + end) + + local defaults = { + ambiwidth='single', + arabicshape=true, + emoji=true, + guifont='', + guifontset='', + guifontwide='', + linespace=0, + showtabline=1, + termguicolors=false, + ext_cmdline=false, + ext_popupmenu=false, + ext_tabline=false, + ext_wildmenu=false, + } + + it("for defaults", function() + screen:attach() + screen:expect(function() + eq(defaults, screen.options) + end) + end) + + it("when setting options", function() + screen:attach() + local changed = {} + for k,v in pairs(defaults) do + changed[k] = v + end + + command("set termguicolors") + changed.termguicolors = true + screen:expect(function() + eq(changed, screen.options) + end) + + command("set guifont=Comic\\ Sans") + changed.guifont = "Comic Sans" + screen:expect(function() + eq(changed, screen.options) + end) + + command("set showtabline=0") + changed.showtabline = 0 + screen:expect(function() + eq(changed, screen.options) + end) + + command("set linespace=13") + changed.linespace = 13 + screen:expect(function() + eq(changed, screen.options) + end) + + command("set linespace=-11") + changed.linespace = -11 + screen:expect(function() + eq(changed, screen.options) + end) + + command("set all&") + screen:expect(function() + eq(defaults, screen.options) + end) + end) + + it('with UI extensions', function() + local changed = {} + for k,v in pairs(defaults) do + changed[k] = v + end + + screen:attach({ext_cmdline=true, ext_wildmenu=true}) + changed.ext_cmdline = true + changed.ext_wildmenu = true + screen:expect(function() + eq(changed, screen.options) + end) + + screen:set_option('ext_popupmenu', true) + changed.ext_popupmenu = true + screen:expect(function() + eq(changed, screen.options) + end) + + screen:set_option('ext_wildmenu', false) + changed.ext_wildmenu = false + screen:expect(function() + eq(changed, screen.options) + end) + end) +end) |