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

Function TestResetClearsChips

internal/tui/prompt_test.go:322–335  ·  view source on GitHub ↗

TestResetClearsChips: Reset empties store and spans, leaving only new text.

(t *testing.T)

Source from the content-addressed store, hash-verified

320
321// TestResetClearsChips: Reset empties store and spans, leaving only new text.
322func TestResetClearsChips(t *testing.T) {
323 p := newChippablePrompt()
324 p, _ = p.Update(pasteKey(makePaste(10)))
325 if len(p.spans) != 1 {
326 t.Fatal("precondition: one chip")
327 }
328 p.Reset()
329 if p.DisplayValue() != "" {
330 t.Fatalf("Reset should empty the textarea, got %q", p.DisplayValue())
331 }
332 if len(p.spans) != 0 || len(p.store) != 0 {
333 t.Fatal("Reset should clear chip state")
334 }
335}
336
337// TestSetValueClearsChips: SetValue installs plain text and drops prior chips,
338// used by slash-popover Tab-completion, where chips can't be part of a replacement.

Callers

nothing calls this directly

Calls 6

newChippablePromptFunction · 0.85
pasteKeyFunction · 0.85
makePasteFunction · 0.85
ResetMethod · 0.80
DisplayValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected