TestBackspaceImmediatelyAfterChipRemovesIt: atomic-delete regression guard, after a paste the cursor sits at chip.end, so one Backspace deletes the chip without any manual cursor setup.
(t *testing.T)
| 471 | // after a paste the cursor sits at chip.end, so one Backspace deletes the chip |
| 472 | // without any manual cursor setup. |
| 473 | func TestBackspaceImmediatelyAfterChipRemovesIt(t *testing.T) { |
| 474 | p := newChippablePrompt() |
| 475 | p, _ = p.Update(pasteKey(makePaste(10))) |
| 476 | // InsertString leaves the cursor at chip.end, tripping the atomic path. |
| 477 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyBackspace}) |
| 478 | |
| 479 | if len(p.spans) != 0 { |
| 480 | t.Fatalf("single Backspace right after paste should remove chip, spans=%+v", p.spans) |
| 481 | } |
| 482 | if p.DisplayValue() != "" { |
| 483 | t.Fatalf("prompt should be empty after chip delete, got %q", p.DisplayValue()) |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | // TestPasteIntoChipInteriorKeepsBothPastes: a paste while the cursor sits inside |
| 488 | // an existing chip's label must not splice the new label into the old one. |
nothing calls this directly
no test coverage detected