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

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