TestEntryRestoreRoundTrip: Entry()+Restore() fully recovers chip state: display text, spans, expanded Value(). Backs ↑/↓ history replay.
(t *testing.T)
| 294 | // TestEntryRestoreRoundTrip: Entry()+Restore() fully recovers chip state: |
| 295 | // display text, spans, expanded Value(). Backs ↑/↓ history replay. |
| 296 | func TestEntryRestoreRoundTrip(t *testing.T) { |
| 297 | p := newChippablePrompt() |
| 298 | paste := makePaste(12) |
| 299 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("pre ")}) |
| 300 | p, _ = p.Update(pasteKey(paste)) |
| 301 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(" post")}) |
| 302 | |
| 303 | entry := p.Entry() |
| 304 | wantDisplay := p.DisplayValue() |
| 305 | wantValue := p.Value() |
| 306 | |
| 307 | q := newChippablePrompt() |
| 308 | q.Restore(entry) |
| 309 | |
| 310 | if got := q.DisplayValue(); got != wantDisplay { |
| 311 | t.Fatalf("DisplayValue mismatch after Restore: %q vs %q", got, wantDisplay) |
| 312 | } |
| 313 | if got := q.Value(); got != wantValue { |
| 314 | t.Fatalf("Value mismatch after Restore") |
| 315 | } |
| 316 | if len(q.spans) != 1 { |
| 317 | t.Fatalf("expected 1 span after Restore, got %d", len(q.spans)) |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | // TestResetClearsChips: Reset empties store and spans, leaving only new text. |
| 322 | func TestResetClearsChips(t *testing.T) { |
nothing calls this directly
no test coverage detected