MCPcopy Create free account
hub / github.com/cogentcore/core / TestBindChange

Function TestBindChange

core/value_test.go:34–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestBindChange(t *testing.T) {
35 b := NewBody()
36 name := "Gopher"
37
38 tf := Bind(&name, NewTextField(b))
39 b.AssertRender(t, "bind/change", func() {
40 tf.HandleEvent(events.NewKey(events.KeyChord, 'G', 0, 0))
41 tf.HandleEvent(events.NewKey(events.KeyChord, 'o', 0, 0))
42 tf.HandleEvent(events.NewKey(events.KeyChord, ' ', 0, 0))
43 assert.Equal(t, "Gopher", name)
44 tf.HandleEvent(events.NewKey(events.KeyChord, 0, key.CodeReturnEnter, 0))
45 assert.Equal(t, "Go Gopher", name)
46 })
47}
48
49func TestBindSpinner(t *testing.T) {
50 b := NewBody()

Callers

nothing calls this directly

Calls 7

AssertRenderMethod · 0.95
NewKeyFunction · 0.92
NewBodyFunction · 0.85
BindFunction · 0.85
NewTextFieldFunction · 0.85
HandleEventMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected