From 8973768a4e317ceccb12442ba40b5456d3f239cb Mon Sep 17 00:00:00 2001 From: bfredl Date: Sun, 17 Apr 2022 11:05:07 +0200 Subject: feat(api): add tests for setting terminal ui options --- test/functional/ui/options_spec.lua | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test/functional/ui/options_spec.lua') diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua index 2f113f6ac6..82f856e4df 100644 --- a/test/functional/ui/options_spec.lua +++ b/test/functional/ui/options_spec.lua @@ -4,6 +4,7 @@ local clear = helpers.clear local command = helpers.command local eq = helpers.eq local shallowcopy = helpers.shallowcopy +local eval = helpers.eval describe('UI receives option updates', function() local screen @@ -168,3 +169,42 @@ describe('UI receives option updates', function() it('from startup options with --headless', function() startup_test(true) end) it('from startup options with --embed', function() startup_test(false) end) end) + +describe('UI can set terminal option', function() + local screen + before_each(function() + -- by default we implicity "--cmd 'set bg=light'" which ruins everything + clear{args_rm={'--cmd'}} + screen = Screen.new(20,5) + end) + + it('term_background', function() + eq('dark', eval '&background') + + screen:attach {term_background='light'} + eq('light', eval '&background') + end) + + it("term_background but not if 'background' already set by user", function() + eq('dark', eval '&background') + command 'set background=dark' + + screen:attach {term_background='light'} + + eq('dark', eval '&background') + end) + + it('term_name', function() + eq('nvim', eval '&term') + + screen:attach {term_name='xterm'} + eq('xterm', eval '&term') + end) + + it('term_colors', function() + eq('256', eval '&t_Co') + + screen:attach {term_colors=8} + eq('8', eval '&t_Co') + end) +end) -- cgit From 86f0da922fbf37278abd62a0fb90fe7e2452ad93 Mon Sep 17 00:00:00 2001 From: Natasha England-Elbro <46329225+0x00002a@users.noreply.github.com> Date: Fri, 15 Jul 2022 18:42:01 +0100 Subject: fix: remote UI may get invalid 'pumblend' value #19379 fixes: https://github.com/neovim/neovim/issues/19340 --- test/functional/ui/options_spec.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/functional/ui/options_spec.lua') diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua index 82f856e4df..346a64c63b 100644 --- a/test/functional/ui/options_spec.lua +++ b/test/functional/ui/options_spec.lua @@ -87,6 +87,12 @@ describe('UI receives option updates', function() eq(expected, screen.options) end) + command("set pumblend=-1") + expected.pumblend = 0 + screen:expect(function() + eq(expected, screen.options) + end) + command("set guifont=Comic\\ Sans") expected.guifont = "Comic Sans" screen:expect(function() -- cgit From eb9b93b5e025386ec9431c9d35a4a073d6946d1d Mon Sep 17 00:00:00 2001 From: matveyt <35012635+matveyt@users.noreply.github.com> Date: Sun, 17 Jul 2022 14:14:04 +0300 Subject: feat(defaults): mouse=nvi #19290 Problem: Since right-click can now show a popup menu, we can provide messaging to guide users who expect 'mouse' to be disabled by default. So 'mouse' can now be enabled by default. Solution: Do it. Closes #15521 --- test/functional/ui/options_spec.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'test/functional/ui/options_spec.lua') diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua index 346a64c63b..c2b0bcdb64 100644 --- a/test/functional/ui/options_spec.lua +++ b/test/functional/ui/options_spec.lua @@ -63,17 +63,18 @@ describe('UI receives option updates', function() end screen:attach() screen:expect(function() - eq({'mouse_off'}, evs) + eq({'mouse_on'}, evs) end) - command("set mouse=nvi") + command("set mouse=") + command("set mouse&") screen:expect(function() - eq({'mouse_off','mouse_on'}, evs) + eq({'mouse_on','mouse_off', 'mouse_on'}, evs) end) screen:detach() - eq({'mouse_off','mouse_on'}, evs) + eq({'mouse_on','mouse_off', 'mouse_on'}, evs) screen:attach() screen:expect(function() - eq({'mouse_off','mouse_on','mouse_on'}, evs) + eq({'mouse_on','mouse_off','mouse_on', 'mouse_on'}, evs) end) end) -- cgit