MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestDeleteAtChipStartRemovesWholeChip

Function TestDeleteAtChipStartRemovesWholeChip

internal/tui/prompt_test.go:114–129  ·  view source on GitHub ↗

TestDeleteAtChipStartRemovesWholeChip: forward-Delete with the cursor right before the label removes the whole chip.

(t *testing.T)

Source from the content-addressed store, hash-verified

112// TestDeleteAtChipStartRemovesWholeChip: forward-Delete with the cursor right
113// before the label removes the whole chip.
114func 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.

Callers

nothing calls this directly

Calls 6

newChippablePromptFunction · 0.85
pasteKeyFunction · 0.85
makePasteFunction · 0.85
setCursorRuneOffsetMethod · 0.80
DisplayValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected