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

Function TestPopoverTabCompletesUniquePrefix

internal/tui/tui_test.go:328–343  ·  view source on GitHub ↗

TestPopoverTabCompletesUniquePrefix: with one match, Tab completes the name and, because /models takes args, appends a space that flips the popover into arg-level mode. Flow: "/mod " → "/models " + arg popover.

(t *testing.T)

Source from the content-addressed store, hash-verified

326// and, because /models takes args, appends a space that flips the popover into
327// arg-level mode. Flow: "/mod<Tab>" → "/models " + arg popover.
328func TestPopoverTabCompletesUniquePrefix(t *testing.T) {
329 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
330 mm := typeInto(m, "/mod") // only /models matches
331 if len(mm.suggest) != 1 {
332 t.Fatalf("precondition: one match for /mod, got %d", len(mm.suggest))
333 }
334 mm2, _ := mm.Update(tea.KeyMsg{Type: tea.KeyTab})
335 om := mm2.(Model)
336 if got := om.ta.Value(); got != "/models " {
337 t.Fatalf("Tab should complete to '/models ' (with trailing space), got %q", got)
338 }
339 if !om.suggestArgLevel || om.activeCmd != "/models" {
340 t.Fatalf("popover should have transitioned to arg-level for /models: "+
341 "level=%v cmd=%q", om.suggestArgLevel, om.activeCmd)
342 }
343}
344
345// TestPopoverTabOnClearCommandHasNoArgSpace: /clear takes no args, so Tab
346// completes to "/clear" WITHOUT a trailing space.

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