MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestStreamContentShowsLiveInViewport

Function TestStreamContentShowsLiveInViewport

internal/tui/tui_test.go:2455–2472  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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").
2460func 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}

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
handleStreamMethod · 0.80
StringMethod · 0.80
ViewMethod · 0.45

Tested by

no test coverage detected