TestBackspaceAtChipEndRemovesWholeChip: Backspace with the cursor right after the label deletes the whole chip and leaves surrounding text intact.
(t *testing.T)
| 91 | // TestBackspaceAtChipEndRemovesWholeChip: Backspace with the cursor right after |
| 92 | // the label deletes the whole chip and leaves surrounding text intact. |
| 93 | func TestBackspaceAtChipEndRemovesWholeChip(t *testing.T) { |
| 94 | p := newChippablePrompt() |
| 95 | // Prefix, big paste, suffix. |
| 96 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("before ")}) |
| 97 | p, _ = p.Update(pasteKey(makePaste(10))) |
| 98 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(" after")}) |
| 99 | |
| 100 | // Cursor to the chip's trailing edge. |
| 101 | p.setCursorRuneOffset(p.spans[0].end) |
| 102 | |
| 103 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyBackspace}) |
| 104 | if len(p.spans) != 0 { |
| 105 | t.Fatalf("Backspace at chip.end must remove the chip; spans=%+v", p.spans) |
| 106 | } |
| 107 | if got := p.DisplayValue(); got != "before after" { |
| 108 | t.Fatalf("after delete value = %q, want 'before after'", got) |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | // TestDeleteAtChipStartRemovesWholeChip: forward-Delete with the cursor right |
| 113 | // before the label removes the whole chip. |
nothing calls this directly
no test coverage detected