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

Function TestPopoverTriggersOnSlash

internal/tui/tui_test.go:249–264  ·  view source on GitHub ↗

TestPopoverTriggersOnSlash: typing / into an empty textarea opens the popover with every command; typing more characters filters by prefix.

(t *testing.T)

Source from the content-addressed store, hash-verified

247// TestPopoverTriggersOnSlash: typing / into an empty textarea opens the
248// popover with every command; typing more characters filters by prefix.
249func TestPopoverTriggersOnSlash(t *testing.T) {
250 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
251 mm := typeInto(m, "/")
252 if !mm.popoverOpen() {
253 t.Fatal("popover should open after typing /")
254 }
255 if len(mm.suggest) != len(commands) {
256 t.Fatalf("all commands should match empty prefix, got %d of %d",
257 len(mm.suggest), len(commands))
258 }
259 mm2 := typeInto(mm, "mod") // "/mod"
260 names := suggestNames(mm2)
261 if len(names) != 1 || names[0] != "/models" {
262 t.Fatalf("expected exactly /models to match /mod, got %v", names)
263 }
264}
265
266// TestPopoverClosesWhenPrefixMatchesNothing: typing a prefix that no command
267// satisfies closes the popover automatically (no empty frame).

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
typeIntoFunction · 0.85
suggestNamesFunction · 0.85
popoverOpenMethod · 0.80

Tested by

no test coverage detected