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 | t.Fatalf("after submit the textarea should collapse to 1 line, got %d", got) |
| 2454 | } |
| 2455 | } |
| 2456 | |
| 2457 | // stripANSI removes CSI escape sequences (`\x1b[…m`) so tests can match the |
| 2458 | // visible text through glamour's per-word styling, which splits "foo bar" into |
| 2459 | // `<span>foo</span> <span>bar</span>` and breaks a naive Contains("foo bar"). |
| 2460 | func stripANSI(s string) string { |
| 2461 | var b strings.Builder |
| 2462 | for i := 0; i < len(s); i++ { |
| 2463 | if s[i] == 0x1b && i+1 < len(s) && s[i+1] == '[' { |
| 2464 | for j := i + 2; j < len(s); j++ { |
| 2465 | if s[j] >= 0x40 && s[j] <= 0x7e { |
| 2466 | i = j |
| 2467 | break |
| 2468 | } |
| 2469 | } |
| 2470 | continue |
| 2471 | } |
| 2472 | b.WriteByte(s[i]) |
| 2473 | } |
| 2474 | return b.String() |
| 2475 | } |
nothing calls this directly
no test coverage detected