Skip to content

Commit

Permalink
test: update tests/nui/menu/init_spec.lua, update the test case of tr…
Browse files Browse the repository at this point in the history
…uncating Chinese characters.
  • Loading branch information
Kurama622 committed Dec 9, 2024
1 parent 4e80c28 commit 93047b8
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/nui/menu/init_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,25 @@ describe("nui.menu", function()
end)
end)

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

menu:mount()

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

describe("separator", function()
it("text supports string", function()
menu = Menu(popup_options, {
Expand Down Expand Up @@ -476,25 +495,6 @@ 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 93047b8

Please sign in to comment.