Skip to content

Commit

Permalink
test: update tests/nui/menu/init_spec.lua, add the test case of trunc…
Browse files Browse the repository at this point in the history
…ating Chinese characters.
  • Loading branch information
Kurama622 committed Dec 9, 2024
1 parent 33feb1d commit 156501d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/nui/menu/init_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,25 @@ describe("nui.menu", function()
})
end)

it("Chinese characters longer than max_width is truncated", function()
menu = Menu(popup_options, {
lines = {
Menu.item("中文长度测试"),
Menu.item("English中文"),
Menu.item("Long Long Group"),
},
max_width = 10,
})

menu:mount()

h.assert_buf_lines(menu.bufnr, {
"中文长度测",
"English中…",
"Long Long…",
})
end)

it("text supports nui.text", function()
local hl_group = "NuiMenuTest"
local text = "Group"
Expand Down

0 comments on commit 156501d

Please sign in to comment.