Add text components 021-040 with demos and behavior tests

This commit is contained in:
ZacharyZhang-NY committed 2026-10-11 18:20:12 -04:00
1 parent 43098065bf
commit 59fde4096d
30 files changed
+1702 -7

No files matched your search

+3 -3
View File
@@ -24,7 +24,7 @@ func TestRuns(t *testing.T) {
}
}
func TestTextLinesEllipsis(t *testing.T) {
func TestWrapEllipsis(t *testing.T) {
cases := []struct {
s string
width, n int
@@ -37,8 +37,8 @@ func TestTextLinesEllipsis(t *testing.T) {
{"像素风格组件库", 36, 2, []string{"像素风", "格组…"}},
}
for _, c := range cases {
if got := textLines(c.s, c.width, c.n); !slices.Equal(got, c.want) {
t.Errorf("textLines(%q, %d, %d) = %q, want %q", c.s, c.width, c.n, got, c.want)
if got := Wrap(c.s, c.width, c.n); !slices.Equal(got, c.want) {
t.Errorf("Wrap(%q, %d, %d) = %q, want %q", c.s, c.width, c.n, got, c.want)
}
}
}