(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestForm_SubmitAction(t *testing.T) { |
| 63 | form := NewForm("Done", |
| 64 | FormItem{Label: "Field", Field: NewTextField("val")}, |
| 65 | ) |
| 66 | submitted := false |
| 67 | form.OnSubmit(func(f *Form) tea.Cmd { |
| 68 | submitted = true |
| 69 | return nil |
| 70 | }) |
| 71 | |
| 72 | formPressTab(&form) |
| 73 | assert.Equal(t, 1, form.Focused(), "submit button") |
| 74 | |
| 75 | form, _ = form.Update(keyPressMsg("enter")) |
| 76 | assert.True(t, submitted) |
| 77 | } |
| 78 | |
| 79 | func TestForm_CancelAction(t *testing.T) { |
| 80 | form := NewForm("Done", |
nothing calls this directly
no test coverage detected
searching dependent graphs…