Skip to content

Commit

Permalink
test(table): test wrapping cell styles
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Mar 10, 2025
1 parent 23d3824 commit 6905bb7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions table/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1810,3 +1810,23 @@ func ExampleTable_Wrap() {
// β”‚ β”‚ ざγͺ。 β”‚ β”‚ β”‚ β”‚
// ╰──────────────┴───────────────┴───────────────┴───────────────┴───────────────╯
}

// Check that stylized wrapped content does not go beyond its cell.
func TestTableWithLinks(t *testing.T) {
headers := []string{"Package", "Version", "Link"}
data := [][]string{
{"sourcegit", "0.19", lipgloss.JoinHorizontal(lipgloss.Left, lipgloss.NewStyle().Foreground(lipgloss.Color("#31BB71")).Render("https://aur.archlinux.org/packages/sourcegit-bin"))},
{},
{"Welcome", "いらっしゃいませ", "Ω…Ψ±Ψ­Ψ¨Ψ§Ω‹", "ν™˜μ˜", "欒迎"},
{"Goodbye", "γ•γ‚ˆγ†γͺら", "Ω…ΨΉ Ψ§Ω„Ψ³Ω„Ψ§Ω…Ψ©", "μ•ˆλ…•νžˆ κ°€μ„Έμš”", "再见"},
}
table := New().
Headers(headers...).
Rows(data...).
// StyleFunc(TableStyle).
Width(80).
Wrap(true)
t.Log(table.String())
// TODO once we have the desired result, save it as a golden file
// golden.RequireEqual(t, []byte(table.String()))
}

0 comments on commit 6905bb7

Please sign in to comment.