TestPromptShrinksAfterSubmit: after Enter submits a multi-line prompt the textarea resets to empty and the height snaps back to 1 line.
(t *testing.T)
| 2411 | // newlines, and clamps to height - minViewport - 2 - popover, so big pastes use |
| 2412 | // most of the screen while chat keeps its floor. |
| 2413 | func TestPromptAutoGrowsWithContent(t *testing.T) { |
| 2414 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 2415 | if m.ta.Height() != 1 { |
| 2416 | t.Fatalf("empty prompt should be 1 line, got %d", m.ta.Height()) |
| 2417 | } |
| 2418 | |
| 2419 | m.ta.SetValue("line1\nline2\nline3\nline4") |
| 2420 | m.recomputeLayout() |
| 2421 | if got := m.ta.Height(); got != 4 { |
| 2422 | t.Fatalf("4 lines in textarea should produce height 4, got %d", got) |
| 2423 | } |
| 2424 | |
| 2425 | // Far past the cap, height must clamp to leave room for chat. With |
| 2426 | // newTestModel's 30-row terminal, cap = 30 - 5 - 2 - 0 = 23. |
| 2427 | m.ta.SetValue(strings.Repeat("x\n", 40) + "end") |
| 2428 | m.recomputeLayout() |
| 2429 | want := m.height - minViewport - 2 |
| 2430 | if got := m.ta.Height(); got != want { |
| 2431 | t.Fatalf("height should clamp to %d (h=%d - minViewport=%d - chrome=2), got %d", |
| 2432 | want, m.height, minViewport, got) |
| 2433 | } |
nothing calls this directly
no test coverage detected