aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/popupmenu_spec.lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2024-07-27 18:14:22 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-07-27 21:43:38 +0800
commit985c636aa6dfcec2a1b788549c3f3ac058c8d141 (patch)
treece2c917933988e1cce11537a5d5e77e24b409e1b /test/functional/ui/popupmenu_spec.lua
parent5be5928771fa4423cd6468914aa698085f5f4656 (diff)
downloadrneovim-985c636aa6dfcec2a1b788549c3f3ac058c8d141.tar.gz
rneovim-985c636aa6dfcec2a1b788549c3f3ac058c8d141.tar.bz2
rneovim-985c636aa6dfcec2a1b788549c3f3ac058c8d141.zip
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.
Diffstat (limited to 'test/functional/ui/popupmenu_spec.lua')
-rw-r--r--test/functional/ui/popupmenu_spec.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 02ac0ada22..26110b559d 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -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