TestFocusBlurMsgsAreInert: terminal focus reports arrive as tea.FocusMsg / tea.BlurMsg under tea.WithReportFocus. They must never touch the textarea (no inserted chars, no height change), else the UI slides up when another window steals focus.
(t *testing.T)
| 2842 | t.Fatalf("splash should recommend a sandbox: %s", joined) |
| 2843 | } |
| 2844 | // A second size message must not re-emit the splash. Clear the captured |
| 2845 | // outbox first, since production drains it but we called update() directly. |
| 2846 | om.outbox = nil |
| 2847 | out2, _ := om.update(tea.WindowSizeMsg{Width: 80, Height: 24}) |
| 2848 | om2 := out2.(Model) |
| 2849 | if joined2 := strings.Join(om2.outbox, "\n"); strings.Contains(joined2, "hamr time") { |
| 2850 | t.Fatalf("splash must be a one-shot, got re-emit: %s", joined2) |
| 2851 | } |
| 2852 | } |
| 2853 | |
| 2854 | // TestStreamingShownInLiveView: the streaming buffer is rendered above |
| 2855 | // the prompt by View() while content is in flight, so the user sees |
| 2856 | // tokens immediately even before the block flushes to scrollback. |
| 2857 | func TestStreamingShownInLiveView(t *testing.T) { |
| 2858 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 2859 | m.streaming.WriteString("live tokens arriving...") |
| 2860 | if !strings.Contains(stripANSI(m.View()), "live tokens arriving") { |
| 2861 | t.Fatalf("View must include streaming buffer: %s", stripANSI(m.View())) |
| 2862 | } |
| 2863 | } |
| 2864 | |
| 2865 | // TestFocusBlurMsgsAreInert: terminal focus reports arrive as tea.FocusMsg / |
| 2866 | // tea.BlurMsg under tea.WithReportFocus. They must never touch the textarea (no |
| 2867 | // inserted chars, no height change), else the UI slides up when another window |
| 2868 | // steals focus. |
| 2869 | func TestFocusBlurMsgsAreInert(t *testing.T) { |
| 2870 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 2871 | beforeVal := m.ta.Value() |
| 2872 | beforeHeight := m.ta.Height() |
| 2873 |
nothing calls this directly
no test coverage detected