mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-05 04:36:07 +00:00
fix(textarea): placeholder with chinese chars (#767)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"unicode"
|
||||
|
||||
"github.com/MakeNowJust/heredoc"
|
||||
"github.com/aymanbagabas/go-udiff"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/charmbracelet/x/ansi"
|
||||
@@ -1671,6 +1672,26 @@ func TestView(t *testing.T) {
|
||||
`),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "placeholder chinese character",
|
||||
modelFunc: func(m Model) Model {
|
||||
m.Placeholder = "输入消息..."
|
||||
m.ShowLineNumbers = true
|
||||
m.SetWidth(20)
|
||||
return m
|
||||
},
|
||||
want: want{
|
||||
view: heredoc.Doc(`
|
||||
> 1 输入消息...
|
||||
>
|
||||
>
|
||||
>
|
||||
>
|
||||
>
|
||||
|
||||
`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -1689,6 +1710,7 @@ func TestView(t *testing.T) {
|
||||
wantView := stripString(tt.want.view)
|
||||
|
||||
if view != wantView {
|
||||
t.Log(udiff.Unified("expected", "got", wantView, view))
|
||||
t.Fatalf("Want:\n%v\nGot:\n%v\n", wantView, view)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user