mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tests: tui_spec: improve/merge OptionSet/deferred
Closes https://github.com/neovim/neovim/pull/11129.
This commit is contained in:
parent
382391bb2d
commit
cd73a0342a
@ -1345,23 +1345,14 @@ describe("TUI", function()
|
|||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('TUI background color', function()
|
it('TUI bg color triggers OptionSet event on terminal-response', function()
|
||||||
local screen
|
-- Only single integration test.
|
||||||
|
-- See test/unit/tui_spec.lua for unit tests.
|
||||||
before_each(function()
|
|
||||||
clear()
|
clear()
|
||||||
screen = thelpers.screen_setup(0, '["'..nvim_prog
|
local screen = thelpers.screen_setup(0, '["'..nvim_prog
|
||||||
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]')
|
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile", '
|
||||||
end)
|
..'"-c", "autocmd OptionSet background echo \\"did OptionSet, yay!\\""]')
|
||||||
|
|
||||||
it("triggers OptionSet event on terminal-response", function()
|
|
||||||
feed_data('\027:autocmd OptionSet background echo "did OptionSet, yay!"\n')
|
|
||||||
|
|
||||||
-- Wait for the child Nvim to register the OptionSet handler.
|
|
||||||
feed_data('\027:autocmd OptionSet\n')
|
|
||||||
screen:expect({any='--- Autocommands ---'})
|
|
||||||
|
|
||||||
feed_data('\012') -- CTRL-L: clear the screen
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{1: } |
|
{1: } |
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
@ -1373,31 +1364,7 @@ describe('TUI background color', function()
|
|||||||
]])
|
]])
|
||||||
feed_data('\027]11;rgb:ffff/ffff/ffff\007')
|
feed_data('\027]11;rgb:ffff/ffff/ffff\007')
|
||||||
screen:expect{any='did OptionSet, yay!'}
|
screen:expect{any='did OptionSet, yay!'}
|
||||||
end)
|
|
||||||
|
|
||||||
it("handles deferred background color", function()
|
feed_data(':echo "new_bg=".&background\n')
|
||||||
local function wait_for_bg(bg)
|
screen:expect{any='new_bg=light'}
|
||||||
-- Retry until the terminal response is handled.
|
|
||||||
retry(100, nil, function()
|
|
||||||
feed_data(':echo &background\n')
|
|
||||||
screen:expect({
|
|
||||||
timeout=40,
|
|
||||||
grid=string.format([[
|
|
||||||
{1: } |
|
|
||||||
{4:~ }|
|
|
||||||
{4:~ }|
|
|
||||||
{4:~ }|
|
|
||||||
{5:[No Name] 0,0-1 All}|
|
|
||||||
%-5s |
|
|
||||||
{3:-- TERMINAL --} |
|
|
||||||
]], bg)
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Only single integration test.
|
|
||||||
-- See test/unit/tui_spec.lua for unit tests.
|
|
||||||
feed_data('\027]11;rgb:ffff/ffff/ffff\007')
|
|
||||||
wait_for_bg('light')
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user