(t *testing.T)
| 237 | } |
| 238 | |
| 239 | func TestForm_ValidationNonRequiredDoesNotBlock(t *testing.T) { |
| 240 | form := NewForm("Submit", |
| 241 | FormItem{Label: "Optional", Field: NewTextField("opt")}, |
| 242 | FormItem{Label: "Required", Field: NewTextField("req"), Required: true}, |
| 243 | ) |
| 244 | submitted := false |
| 245 | form.OnSubmit(func(f *Form) tea.Cmd { |
| 246 | submitted = true |
| 247 | return nil |
| 248 | }) |
| 249 | |
| 250 | formPressTab(&form) // focus second field |
| 251 | formTypeText(&form, "filled") |
| 252 | formFocusSubmit(&form) |
| 253 | formPressEnter(&form) |
| 254 | |
| 255 | assert.True(t, submitted) |
| 256 | assert.False(t, form.HasError()) |
| 257 | } |
| 258 | |
| 259 | func TestForm_ValidationOnClickSubmit(t *testing.T) { |
| 260 | form := NewForm("Submit", |
nothing calls this directly
no test coverage detected
searching dependent graphs…