aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/highlight_spec.lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-02-01 17:16:14 +0100
committerGitHub <noreply@github.com>2022-02-01 17:16:14 +0100
commit5be2cdd913ce94bf3b88ce70042fbf7a92066459 (patch)
tree960442a3778992bc3d33e7a55a7de66c4196f555 /test/functional/api/highlight_spec.lua
parentf4300985d3212887ef27d703ba8cb4230813e095 (diff)
parent4aa0cdd3aa117e032325edeb755107acd4ecbf84 (diff)
downloadrneovim-5be2cdd913ce94bf3b88ce70042fbf7a92066459.tar.gz
rneovim-5be2cdd913ce94bf3b88ce70042fbf7a92066459.tar.bz2
rneovim-5be2cdd913ce94bf3b88ce70042fbf7a92066459.zip
Merge pull request #17187 from lewis6991/master
feat(highlight): ns=0 to set :highlight namespace
Diffstat (limited to 'test/functional/api/highlight_spec.lua')
-rw-r--r--test/functional/api/highlight_spec.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index 21e3094f8e..a74da6073a 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -3,6 +3,7 @@ local clear, nvim = helpers.clear, helpers.nvim
local Screen = require('test.functional.ui.screen')
local eq, eval = helpers.eq, helpers.eval
local command = helpers.command
+local exec_capture = helpers.exec_capture
local meths = helpers.meths
local funcs = helpers.funcs
local pcall_err = helpers.pcall_err
@@ -252,4 +253,23 @@ describe("API: set highlight", function()
eq(highlight3_result_gui, meths.get_hl_by_name('Test_hl', true))
eq(highlight3_result_cterm, meths.get_hl_by_name('Test_hl', false))
end)
+
+ it ("can set a highlight in the global namespace", function()
+ meths.set_hl(0, 'Test_hl', highlight2_config)
+ eq('Test_hl xxx cterm=underline,reverse ctermfg=8 ctermbg=15 gui=underline,reverse',
+ exec_capture('highlight Test_hl'))
+
+ meths.set_hl(0, 'Test_hl', { background = highlight_color.bg })
+ eq('Test_hl xxx guibg=#0032aa',
+ exec_capture('highlight Test_hl'))
+
+ meths.set_hl(0, 'Test_hl2', highlight3_config)
+ eq('Test_hl2 xxx cterm=undercurl,italic,reverse ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,italic,reverse guifg=#ff0000 guibg=#0032aa',
+ exec_capture('highlight Test_hl2'))
+
+ -- Colors are stored exactly as they are defined.
+ meths.set_hl(0, 'Test_hl3', { bg = 'reD', fg = 'bLue'})
+ eq('Test_hl3 xxx guifg=bLue guibg=reD',
+ exec_capture('highlight Test_hl3'))
+ end)
end)