MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestPopoverShiftTabCyclesUp

Function TestPopoverShiftTabCyclesUp

internal/tui/tui_test.go:361–372  ·  view source on GitHub ↗

TestPopoverShiftTabCyclesUp: Shift+Tab walks the selection backwards, wrapping at the top.

(t *testing.T)

Source from the content-addressed store, hash-verified

359// TestPopoverShiftTabCyclesUp: Shift+Tab walks the selection backwards,
360// wrapping at the top.
361func TestPopoverShiftTabCyclesUp(t *testing.T) {
362 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
363 mm := typeInto(m, "/")
364 n := len(mm.suggest)
365 if !mm.popoverOpen() || n < 2 {
366 t.Fatalf("precondition: popover open with ≥2 options, got %d", n)
367 }
368 mm2, _ := mm.Update(tea.KeyMsg{Type: tea.KeyShiftTab})
369 if mm2.(Model).suggestIdx != (mm.suggestIdx-1+n)%n {
370 t.Fatalf("Shift+Tab should move selection up, got idx=%d", mm2.(Model).suggestIdx)
371 }
372}
373
374// TestEscFromCommandLevelClosesAndClears: Esc at command-level closes the
375// popover AND clears the textarea, so the user returns to a blank prompt.

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
typeIntoFunction · 0.85
popoverOpenMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected