TestUnqueueRestoresToTextarea: Backspace on an empty prompt while a turn runs pulls the queued prompt back into the textarea and clears the slot, a reversible way to edit or drop it.
(t *testing.T)
| 242 | // TestUnqueueRestoresToTextarea: Backspace on an empty prompt while a turn runs |
| 243 | // pulls the queued prompt back into the textarea and clears the slot, a |
| 244 | // reversible way to edit or drop it. |
| 245 | func TestUnqueueRestoresToTextarea(t *testing.T) { |
| 246 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 247 | m.phase = phaseThinking |
| 248 | m.queued = &queuedPrompt{send: "hello there", echo: "hello there"} |
| 249 | |
| 250 | out, _ := m.Update(tea.KeyMsg{Type: tea.KeyBackspace}) |
| 251 | om := out.(Model) |
| 252 | |
| 253 | if om.ta.Value() != "hello there" { |
| 254 | t.Fatalf("Backspace must restore the queued text, got %q", om.ta.Value()) |
| 255 | } |
| 256 | if om.queued != nil { |
| 257 | t.Fatalf("unqueue must clear the slot, got %+v", om.queued) |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | // TestUnqueueOnlyWhenTextareaEmpty: with a draft already in the textarea, |
nothing calls this directly
no test coverage detected