feat: include NormalBorder in DefaultStyles

This commit is contained in:
bashbunni
2024-09-11 14:47:04 -07:00
parent 63869e3889
commit 87b61f8646
2 changed files with 3 additions and 11 deletions
+1
View File
@@ -124,6 +124,7 @@ type Styles struct {
// DefaultStyles returns a set of default style definitions for this table.
func DefaultStyles() Styles {
return Styles{
Border: lipgloss.NormalBorder(),
BorderHeader: true,
Selected: lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("212")),
Header: lipgloss.NewStyle().Bold(true).Padding(0, 1),
+2 -11
View File
@@ -61,15 +61,10 @@ func deepEqual(a, b []Row) bool {
return true
}
// func TestWithColumns(t *testing.T) {
// t.Run("With columns")
//
// t.Run("set headers directly")
// }
func TestTableAlignment(t *testing.T) {
t.Run("No border", func(t *testing.T) {
s := DefaultStyles()
s.Border = lipgloss.HiddenBorder()
s.BorderHeader = false
biscuits := New(
WithHeight(5),
@@ -89,10 +84,6 @@ func TestTableAlignment(t *testing.T) {
golden.RequireEqual(t, []byte(got))
})
t.Run("With border", func(t *testing.T) {
s := DefaultStyles()
s.Border = lipgloss.NormalBorder()
s.BorderStyle = lipgloss.NewStyle().BorderForeground(lipgloss.Color("240"))
biscuits := New(
WithHeight(5),
WithColumns([]Column{
@@ -105,7 +96,7 @@ func TestTableAlignment(t *testing.T) {
{"Tim Tams", "Australia", "No"},
{"Hobnobs", "UK", "Yes"},
}),
WithStyles(s),
WithStyles(DefaultStyles()),
)
got := ansi.Strip(biscuits.View())
golden.RequireEqual(t, []byte(got))