TestTypingShiftsSpans: typing before a chip shifts its span right by one; reconcile tracks it automatically.
(t *testing.T)
| 272 | // TestTypingShiftsSpans: typing before a chip shifts its span right by one; |
| 273 | // reconcile tracks it automatically. |
| 274 | func TestTypingShiftsSpans(t *testing.T) { |
| 275 | p := newChippablePrompt() |
| 276 | p, _ = p.Update(pasteKey(makePaste(10))) |
| 277 | origStart := p.spans[0].start |
| 278 | if origStart != 0 { |
| 279 | t.Fatalf("precondition: chip starts at 0, got %d", origStart) |
| 280 | } |
| 281 | |
| 282 | // Move cursor home, type a character. |
| 283 | p.setCursorRuneOffset(0) |
| 284 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("x")}) |
| 285 | |
| 286 | if len(p.spans) != 1 { |
| 287 | t.Fatalf("typing before chip must not destroy it, spans=%+v", p.spans) |
| 288 | } |
| 289 | if p.spans[0].start != 1 { |
| 290 | t.Fatalf("chip start should shift to 1, got %d", p.spans[0].start) |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | // TestEntryRestoreRoundTrip: Entry()+Restore() fully recovers chip state: |
| 295 | // display text, spans, expanded Value(). Backs ↑/↓ history replay. |
nothing calls this directly
no test coverage detected