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

Function TestPopoverTabCyclesSelection

internal/tui/tui_test.go:278–296  ·  view source on GitHub ↗

TestPopoverTabCyclesSelection: Tab moves the selection to the next row without touching the textarea, zsh-style cycling.

(t *testing.T)

Source from the content-addressed store, hash-verified

276
277// TestPopoverTabCyclesSelection: Tab moves the selection to the next row
278// without touching the textarea, zsh-style cycling.
279func TestPopoverTabCyclesSelection(t *testing.T) {
280 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
281 mm := typeInto(m, "/")
282 if !mm.popoverOpen() || len(mm.suggest) < 2 {
283 t.Fatalf("precondition: popover open with ≥2 options, got %d", len(mm.suggest))
284 }
285 start := mm.suggestIdx
286 mm2, _ := mm.Update(tea.KeyMsg{Type: tea.KeyTab})
287 if mm2.(Model).suggestIdx != (start+1)%len(mm.suggest) {
288 t.Fatalf("Tab should advance selection, got idx=%d (was %d)",
289 mm2.(Model).suggestIdx, start)
290 }
291 if got := mm2.(Model).ta.Value(); got != "/" {
292 t.Fatalf("textarea must not change on Tab cycle: %q", got)
293 }
294 if !mm2.(Model).popoverOpen() {
295 t.Fatal("popover should stay open after Tab")
296 }
297}
298
299// TestPopoverTabOnEmptyOpensCommandList: Tab on an empty textarea is

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected