mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-05 04:36:07 +00:00
fix(table): crlf on windows
This commit is contained in:
+9
-2
@@ -1,6 +1,7 @@
|
||||
package table
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/charmbracelet/lipgloss/v2"
|
||||
@@ -124,7 +125,7 @@ func TestTableAlignment(t *testing.T) {
|
||||
{"Hobnobs", "UK", "Yes"},
|
||||
}),
|
||||
)
|
||||
got := ansi.Strip(biscuits.View())
|
||||
got := ansiStrip(biscuits.View())
|
||||
golden.RequireEqual(t, []byte(got))
|
||||
})
|
||||
t.Run("With border", func(t *testing.T) {
|
||||
@@ -153,7 +154,13 @@ func TestTableAlignment(t *testing.T) {
|
||||
}),
|
||||
WithStyles(s),
|
||||
)
|
||||
got := ansi.Strip(baseStyle.Render(biscuits.View()))
|
||||
got := ansiStrip(baseStyle.Render(biscuits.View()))
|
||||
golden.RequireEqual(t, []byte(got))
|
||||
})
|
||||
}
|
||||
|
||||
func ansiStrip(s string) string {
|
||||
// Replace all \r\n with \n
|
||||
s = strings.ReplaceAll(s, "\r\n", "\n")
|
||||
return ansi.Strip(s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user