Chat Messages: components 201-220

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 14:25:10 -04:00
1 parent 6f0c02d339
commit 9677fad17c
121 files changed
+5737 -1

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
package mujica
import (
"testing"
"github.com/egoist/mygo/ui"
)
func TestTypingIndicatorMotionAndStatic(t *testing.T) {
for _, reduce := range []bool{false, true} {
tt := ui.NewTester(func(c *ui.Context) {
Use(c, Settings{})
TypingIndicator(c, "Herald")
}, 300, 100)
tt.SetPreferences(ui.Preferences{ReduceMotion: reduce, TextScale: 1})
tt.Frame()
if _, ok := tt.Find("Herald is typing…"); !ok {
t.Fatalf("reduce %v: not named", reduce)
}
shown := 0
for _, s := range tt.Texts() {
if s == "Herald is typing…" {
shown++
}
}
// The status label always; the static text only under reduced motion.
if want := map[bool]int{false: 1, true: 2}[reduce]; shown != want {
t.Errorf("reduce %v: %d labels, want %d", reduce, shown, want)
}
}
}
func TestTypingIndicatorNeedsName(t *testing.T) {
defer func() {
if recover() == nil {
t.Fatal("no panic without a name")
}
}()
ui.NewTester(func(c *ui.Context) {
Use(c, Settings{})
TypingIndicator(c, "")
}, 100, 100)
}
func TestTypingIndicatorSnapshot(t *testing.T) {
snapshot(t, "typing_indicator", 240, 60, func(c *ui.Context) {
ui.Column(c).Padding(12).Children(func() { TypingIndicator(c, "Herald") })
})
}