MCPcopy
hub / github.com/basecamp/once / TestForm_ShiftTabCycling

Function TestForm_ShiftTabCycling

internal/ui/form_test.go:30–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestForm_ShiftTabCycling(t *testing.T) {
31 form := NewForm("Submit",
32 FormItem{Label: "First", Field: NewTextField("first")},
33 FormItem{Label: "Second", Field: NewTextField("second")},
34 )
35
36 formPressShiftTab(&form)
37 assert.Equal(t, 3, form.Focused(), "cancel button")
38
39 formPressShiftTab(&form)
40 assert.Equal(t, 2, form.Focused(), "submit button")
41
42 formPressShiftTab(&form)
43 assert.Equal(t, 1, form.Focused())
44
45 formPressShiftTab(&form)
46 assert.Equal(t, 0, form.Focused())
47}
48
49func TestForm_EnterAdvancesFocus(t *testing.T) {
50 form := NewForm("Submit",

Callers

nothing calls this directly

Calls 5

FocusedMethod · 0.95
NewFormFunction · 0.85
NewTextFieldFunction · 0.85
formPressShiftTabFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…