TestLargePasteBecomesChip: a ≥pasteChipMinLines paste collapses to one chip. DisplayValue shows the label, Value expands back to the original.
(t *testing.T)
| 72 | // TestLargePasteBecomesChip: a ≥pasteChipMinLines paste collapses to one chip. |
| 73 | // DisplayValue shows the label, Value expands back to the original. |
| 74 | func 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. |
nothing calls this directly
no test coverage detected