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

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