MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestPopoverArrowKeysMoveSelection

Function TestPopoverArrowKeysMoveSelection

internal/tui/tui_test.go:397–411  ·  view source on GitHub ↗

TestPopoverArrowKeysMoveSelection: while popover is open, ↑/↓ move the selection (NOT arrow history), and the textarea is not clobbered.

(t *testing.T)

Source from the content-addressed store, hash-verified

395
396// TestPopoverArrowKeysMoveSelection: while popover is open, ↑/↓ move the
397// selection (NOT arrow history), and the textarea is not clobbered.
398func TestPopoverArrowKeysMoveSelection(t *testing.T) {
399 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
400 m.promptHistory = []promptEntry{{display: "old prompt"}} // should NOT be recalled while popover open
401 mm := typeInto(m, "/")
402 start := mm.suggestIdx
403 n := len(mm.suggest)
404 mm2, _ := mm.Update(tea.KeyMsg{Type: tea.KeyDown})
405 if mm2.(Model).suggestIdx != (start+1)%n {
406 t.Fatalf("↓ should move selection, got idx=%d (was %d)",
407 mm2.(Model).suggestIdx, start)
408 }
409 if got := mm2.(Model).ta.Value(); got != "/" {
410 t.Fatalf("textarea must not be overwritten by history while popover open: %q", got)
411 }
412}
413
414// TestPopoverEnterAdvancesIntoArgsForArgsCommand: Enter at command-level on a

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
typeIntoFunction · 0.85
ValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected