TestPopoverTriggersOnSlash: typing / into an empty textarea opens the popover with every command; typing more characters filters by prefix.
(t *testing.T)
| 247 | // TestPopoverTriggersOnSlash: typing / into an empty textarea opens the |
| 248 | // popover with every command; typing more characters filters by prefix. |
| 249 | func 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). |
nothing calls this directly
no test coverage detected