diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-01-24 09:36:15 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2022-02-01 11:54:12 +0000 |
commit | 4aa0cdd3aa117e032325edeb755107acd4ecbf84 (patch) | |
tree | d12b773dde26f9dc40664576638ec7b1a781a4fb /test/functional/api/highlight_spec.lua | |
parent | a562b5771ea91becd0a469378ec852feaf50d2d0 (diff) | |
download | rneovim-4aa0cdd3aa117e032325edeb755107acd4ecbf84.tar.gz rneovim-4aa0cdd3aa117e032325edeb755107acd4ecbf84.tar.bz2 rneovim-4aa0cdd3aa117e032325edeb755107acd4ecbf84.zip |
feat(highlight): ns=0 to set :highlight namespace
Passing ns=0 to nvim_set_hl will alter the `:highlight` namespace.
Diffstat (limited to 'test/functional/api/highlight_spec.lua')
-rw-r--r-- | test/functional/api/highlight_spec.lua | 20 |
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) |