mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
feat: sequence support BatchMsg
This commit is contained in:
committed by
Christian Rocha
parent
a3dc561104
commit
e95e1a0db5
24
tea_test.go
24
tea_test.go
@@ -173,6 +173,30 @@ func TestTeaSequenceMsg(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTeaSequenceMsgWithBatchMsg(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
var in bytes.Buffer
|
||||
|
||||
inc := func() Msg {
|
||||
return incrementMsg{}
|
||||
}
|
||||
batch := func() Msg {
|
||||
return BatchMsg{inc, inc}
|
||||
}
|
||||
|
||||
m := &testModel{}
|
||||
p := NewProgram(m, WithInput(&in), WithOutput(&buf))
|
||||
go p.Send(sequenceMsg{batch, inc, Quit})
|
||||
|
||||
if _, err := p.Run(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if m.counter.Load() != 3 {
|
||||
t.Fatalf("counter should be 3, got %d", m.counter.Load())
|
||||
}
|
||||
}
|
||||
|
||||
func TestTeaSend(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
var in bytes.Buffer
|
||||
|
||||
Reference in New Issue
Block a user