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

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