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

Function TestLargePasteBecomesChip

internal/tui/prompt_test.go:74–89  ·  view source on GitHub ↗

TestLargePasteBecomesChip: a ≥pasteChipMinLines paste collapses to one chip. DisplayValue shows the label, Value expands back to the original.

(t *testing.T)

Source from the content-addressed store, hash-verified

72// TestLargePasteBecomesChip: a ≥pasteChipMinLines paste collapses to one chip.
73// DisplayValue shows the label, Value expands back to the original.
74func TestLargePasteBecomesChip(t *testing.T) {
75 p := newChippablePrompt()
76 big := makePaste(pasteChipMinLines + 4)
77 p, _ = p.Update(pasteKey(big))
78
79 if len(p.spans) != 1 {
80 t.Fatalf("big paste should produce 1 chip, got %d spans", len(p.spans))
81 }
82 wantLabel := fmt.Sprintf("[Pasted text +%d lines]", pasteChipMinLines+4)
83 if got := p.DisplayValue(); got != wantLabel {
84 t.Fatalf("DisplayValue = %q, want %q", got, wantLabel)
85 }
86 if got := p.Value(); got != big {
87 t.Fatalf("Value should expand chip back to original content")
88 }
89}
90
91// TestBackspaceAtChipEndRemovesWholeChip: Backspace with the cursor right after
92// the label deletes the whole chip and leaves surrounding text intact.

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected