wip: filepicker, help, list, table, textarea, textinput, viewport

This commit is contained in:
Carlos Alexandro Becker
2024-02-26 13:31:26 -03:00
parent 8f8d5fc7d9
commit e9bbc869c0
11 changed files with 76 additions and 62 deletions
+10 -3
View File
@@ -1,10 +1,16 @@
package table
import "testing"
import (
"testing"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
func TestFromValues(t *testing.T) {
input := "foo1,bar1\nfoo2,bar2\nfoo3,bar3"
table := New(WithColumns([]Column{{Title: "Foo"}, {Title: "Bar"}}))
ctx := &tea.Context{Renderer: lipgloss.DefaultRenderer()}
table := New(ctx, WithColumns([]Column{{Title: "Foo"}, {Title: "Bar"}}))
table.FromValues(input, ",")
if len(table.rows) != 3 {
@@ -22,8 +28,9 @@ func TestFromValues(t *testing.T) {
}
func TestFromValuesWithTabSeparator(t *testing.T) {
ctx := &tea.Context{Renderer: lipgloss.DefaultRenderer()}
input := "foo1.\tbar1\nfoo,bar,baz\tbar,2"
table := New(WithColumns([]Column{{Title: "Foo"}, {Title: "Bar"}}))
table := New(ctx, WithColumns([]Column{{Title: "Foo"}, {Title: "Bar"}}))
table.FromValues(input, "\t")
if len(table.rows) != 2 {