TestDeleteAtChipStartRemovesWholeChip: forward-Delete with the cursor right before the label removes the whole chip.
(t *testing.T)
| 112 | // TestDeleteAtChipStartRemovesWholeChip: forward-Delete with the cursor right |
| 113 | // before the label removes the whole chip. |
| 114 | func TestDeleteAtChipStartRemovesWholeChip(t *testing.T) { |
| 115 | p := newChippablePrompt() |
| 116 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("prefix")}) |
| 117 | p, _ = p.Update(pasteKey(makePaste(12))) |
| 118 | |
| 119 | // Cursor at chip start. |
| 120 | p.setCursorRuneOffset(p.spans[0].start) |
| 121 | |
| 122 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyDelete}) |
| 123 | if len(p.spans) != 0 { |
| 124 | t.Fatalf("Delete at chip.start must remove the chip; spans=%+v", p.spans) |
| 125 | } |
| 126 | if got := p.DisplayValue(); got != "prefix" { |
| 127 | t.Fatalf("after delete value = %q, want 'prefix'", got) |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | // TestLeftArrowAtChipEndJumpsToStart: ← jumps the cursor across the whole chip |
| 132 | // in one keystroke; it never lands on interior positions. |
nothing calls this directly
no test coverage detected