test(ui/popupmenu_spec): add case of hl_group field in complete items

Problem:  Missing test case for hl_group field in complete items.
Solution: Add a test case for hl_group field.
This commit is contained in:
glepnir
2024-07-27 18:14:22 +08:00
committed by zeertzjq
parent 5be5928771
commit 985c636aa6

View File

@@ -1179,6 +1179,8 @@ describe('builtin popupmenu', function()
xn = { foreground = Screen.colors.White, background = Screen.colors.Plum1 },
ms = { foreground = Screen.colors.Blue, background = Screen.colors.Grey },
mn = { foreground = Screen.colors.Blue, background = Screen.colors.Plum1 },
ds = { foreground = Screen.colors.DarkRed, background = Screen.colors.Grey },
dn = { foreground = Screen.colors.DarkRed, background = Screen.colors.Plum1 },
})
screen:attach({ ext_multigrid = multigrid })
end)
@@ -4931,6 +4933,35 @@ describe('builtin popupmenu', function()
feed('<C-E><Esc>')
end)
-- oldtest: Test_pum_extrahl()
it('custom hl_group override', function()
exec([[
hi StrikeFake guifg=DarkRed
func CompleteFunc( findstart, base )
if a:findstart
return 0
endif
return {
\ 'words': [
\ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', 'hl_group': 'StrikeFake' },
\ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', },
\ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'W', 'hl_group': 'StrikeFake' },
\]}
endfunc
set completeopt=menu
set completefunc=CompleteFunc
]])
feed('<ESC>iaw<C-X><C-U>')
screen:expect([[
aword1^ |
{ds:aword1 W extra text 1 }{1: }|
{n:aword2 W extra text 2 }{1: }|
{dn:你好 W extra text 3 }{1: }|
{1:~ }|*15
{2:-- }{5:match 1 of 3} |
]])
end)
end
end