TestStreamContentShowsLiveInViewport: a mid-turn content event populates the streaming buffer, promotes phase thinking→streaming, and is visible in View() before any EventDone: the "tokens stream immediately" promise.
(t *testing.T)
| 2453 | // newTestModel's 30-row terminal, cap = 30 - 5 - 2 - 0 = 23. |
| 2454 | m.ta.SetValue(strings.Repeat("x\n", 40) + "end") |
| 2455 | m.recomputeLayout() |
| 2456 | want := m.height - minViewport - 2 |
| 2457 | if got := m.ta.Height(); got != want { |
| 2458 | t.Fatalf("height should clamp to %d (h=%d - minViewport=%d - chrome=2), got %d", |
| 2459 | want, m.height, minViewport, got) |
| 2460 | } |
| 2461 | } |
| 2462 | |
| 2463 | // TestPromptShrinksAfterSubmit: after Enter submits a multi-line prompt the |
| 2464 | // textarea resets to empty and the height snaps back to 1 line. |
| 2465 | func TestPromptShrinksAfterSubmit(t *testing.T) { |
| 2466 | m := newTestModel(t, func(w http.ResponseWriter, _ *http.Request) { |
| 2467 | fmt.Fprint(w, "data: "+`{"choices":[{"delta":{"content":"ok"}}]}`+"\n\n") |
| 2468 | fmt.Fprint(w, "data: [DONE]\n\n") |
| 2469 | }) |
| 2470 | m.ta.SetValue("line1\nline2\nline3\nline4") |
| 2471 | m.recomputeLayout() |
| 2472 | if m.ta.Height() != 4 { |
| 2473 | t.Fatalf("precondition: 4-line draft, got height %d", m.ta.Height()) |
| 2474 | } |
| 2475 | // Enter at idle submits the current textarea value and calls ta.Reset; |
nothing calls this directly
no test coverage detected