WIP components (as built)

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 15:51:57 -04:00
1 parent 299e5fe720
commit 4b8fdf8df7
71 files changed
+3241 -468

No files matched your search

-44
View File
@@ -55,47 +55,3 @@ func TestShimmerSnapshot(t *testing.T) {
})
})
}
func TestShimmerTextSweepsAndStops(t *testing.T) {
active := true
tt, n := motionFrames(func(c *ui.Context) {
ShimmerText(c, "Thinking", ShimmerTextOptions{Active: active})
}, 200, 60)
if _, ok := tt.Find("Thinking"); !ok {
t.Fatal("text not named")
}
a := encode(t, tt.Image())
time.Sleep(200 * time.Millisecond)
tt.Frame()
if bytes.Equal(a, encode(t, tt.Image())) || !motionBusy(tt, n) {
t.Fatal("no sweep")
}
active = false
tt.Frame()
if motionBusy(tt, n) || !tt.HasText("Thinking") {
t.Fatal("inactive text still sweeps")
}
active = true
tt.SetPreferences(ui.Preferences{ReduceMotion: true, TextScale: 1})
if motionBusy(tt, n) {
t.Fatal("sweeps under reduced motion")
}
defer func() {
if recover() == nil {
t.Fatal("empty text did not panic")
}
}()
ui.Render(func(c *ui.Context) {
Use(c, Settings{})
ShimmerText(c, "", ShimmerTextOptions{})
}, 100, 50, 1)
}
func TestShimmerTextSnapshot(t *testing.T) {
snapshot(t, "shimmer_text", 300, 80, func(c *ui.Context) {
ui.Column(c).Padding(16).Gap(8).Children(func() {
ShimmerText(c, "Thinking…", ShimmerTextOptions{Active: true})
ShimmerText(c, "思考中…", ShimmerTextOptions{})
})
})
}