MCPcopy Create free account
hub / github.com/codehamr/codehamr / stripANSI

Function stripANSI

internal/tui/tui_test.go:2435–2450  ·  view source on GitHub ↗

stripANSI removes CSI escape sequences (`\x1b[…m`) so tests can match the visible text through glamour's per-word styling, which splits "foo bar" into ` foo bar ` and breaks a naive Contains("foo bar").

(s string)

Source from the content-addressed store, hash-verified

2433 t.Fatalf("long wrapped line should expand textarea past 1 row, got %d", got)
2434 }
2435}
2436
2437// TestPromptAutoGrowsWithContent: the textarea starts at 1 line, grows with
2438// newlines, and clamps to height - minViewport - 2 - popover, so big pastes use
2439// most of the screen while chat keeps its floor.
2440func TestPromptAutoGrowsWithContent(t *testing.T) {
2441 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
2442 if m.ta.Height() != 1 {
2443 t.Fatalf("empty prompt should be 1 line, got %d", m.ta.Height())
2444 }
2445
2446 m.ta.SetValue("line1\nline2\nline3\nline4")
2447 m.recomputeLayout()
2448 if got := m.ta.Height(); got != 4 {
2449 t.Fatalf("4 lines in textarea should produce height 4, got %d", got)
2450 }
2451
2452 // Far past the cap, height must clamp to leave room for chat. With
2453 // newTestModel's 30-row terminal, cap = 30 - 5 - 2 - 0 = 23.

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected