TestLeftArrowAtChipEndJumpsToStart: ← jumps the cursor across the whole chip in one keystroke; it never lands on interior positions.
(t *testing.T)
| 131 | // TestLeftArrowAtChipEndJumpsToStart: ← jumps the cursor across the whole chip |
| 132 | // in one keystroke; it never lands on interior positions. |
| 133 | func TestLeftArrowAtChipEndJumpsToStart(t *testing.T) { |
| 134 | p := newChippablePrompt() |
| 135 | p, _ = p.Update(pasteKey(makePaste(9))) |
| 136 | p.setCursorRuneOffset(p.spans[0].end) |
| 137 | |
| 138 | before := p.cursorRuneOffset() |
| 139 | wantStart := p.spans[0].start |
| 140 | p, _ = p.Update(tea.KeyMsg{Type: tea.KeyLeft}) |
| 141 | after := p.cursorRuneOffset() |
| 142 | |
| 143 | if before == after { |
| 144 | t.Fatal("← should have moved the cursor") |
| 145 | } |
| 146 | if after != wantStart { |
| 147 | t.Fatalf("← at chip.end should land at chip.start=%d, got %d", wantStart, after) |
| 148 | } |
| 149 | if len(p.spans) != 1 { |
| 150 | t.Fatal("← must not delete the chip") |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | // TestRightArrowAtChipStartJumpsToEnd: → skips the whole chip in one keystroke. |
| 155 | func TestRightArrowAtChipStartJumpsToEnd(t *testing.T) { |
nothing calls this directly
no test coverage detected