Skip to content

Commit 2aa2eb0

Browse files
bashbunniandreynering
authored andcommitted
test(table): test wrapping cell styles
1 parent 9500f10 commit 2aa2eb0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

β€Žtable/table_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,3 +1810,23 @@ func ExampleTable_Wrap() {
18101810
// β”‚ β”‚ ざγͺ。 β”‚ β”‚ β”‚ β”‚
18111811
// ╰──────────────┴───────────────┴───────────────┴───────────────┴───────────────╯
18121812
}
1813+
1814+
// Check that stylized wrapped content does not go beyond its cell.
1815+
func TestTableWithLinks(t *testing.T) {
1816+
headers := []string{"Package", "Version", "Link"}
1817+
data := [][]string{
1818+
{"sourcegit", "0.19", lipgloss.JoinHorizontal(lipgloss.Left, lipgloss.NewStyle().Foreground(lipgloss.Color("#31BB71")).Render("https://aur.archlinux.org/packages/sourcegit-bin"))},
1819+
{},
1820+
{"Welcome", "いらっしゃいませ", "Ω…Ψ±Ψ­Ψ¨Ψ§Ω‹", "ν™˜μ˜", "欒迎"},
1821+
{"Goodbye", "γ•γ‚ˆγ†γͺら", "Ω…ΨΉ Ψ§Ω„Ψ³Ω„Ψ§Ω…Ψ©", "μ•ˆλ…•νžˆ κ°€μ„Έμš”", "再见"},
1822+
}
1823+
table := New().
1824+
Headers(headers...).
1825+
Rows(data...).
1826+
// StyleFunc(TableStyle).
1827+
Width(80).
1828+
Wrap(true)
1829+
t.Log(table.String())
1830+
// TODO once we have the desired result, save it as a golden file
1831+
// golden.RequireEqual(t, []byte(table.String()))
1832+
}

0 commit comments

Comments
Β (0)