mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
fix(list): tests
This commit is contained in:
+5
-3
@@ -29,7 +29,8 @@ func (d itemDelegate) Render(w io.Writer, m Model, index int, listItem Item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStatusBarItemName(t *testing.T) {
|
func TestStatusBarItemName(t *testing.T) {
|
||||||
list := New([]Item{item("foo"), item("bar")}, itemDelegate{}, 10, 10)
|
list := New(WithItems(item("foo"), item("bar")),
|
||||||
|
WithDelegate(itemDelegate{}), WithSize(10, 10))
|
||||||
expected := "2 items"
|
expected := "2 items"
|
||||||
if !strings.Contains(list.statusView(), expected) {
|
if !strings.Contains(list.statusView(), expected) {
|
||||||
t.Fatalf("Error: expected view to contain %s", expected)
|
t.Fatalf("Error: expected view to contain %s", expected)
|
||||||
@@ -43,7 +44,7 @@ func TestStatusBarItemName(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStatusBarWithoutItems(t *testing.T) {
|
func TestStatusBarWithoutItems(t *testing.T) {
|
||||||
list := New([]Item{}, itemDelegate{}, 10, 10)
|
list := New(WithDelegate(itemDelegate{}), WithSize(10, 10))
|
||||||
|
|
||||||
expected := "No items"
|
expected := "No items"
|
||||||
if !strings.Contains(list.statusView(), expected) {
|
if !strings.Contains(list.statusView(), expected) {
|
||||||
@@ -52,7 +53,8 @@ func TestStatusBarWithoutItems(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCustomStatusBarItemName(t *testing.T) {
|
func TestCustomStatusBarItemName(t *testing.T) {
|
||||||
list := New([]Item{item("foo"), item("bar")}, itemDelegate{}, 10, 10)
|
list := New(WithItems(item("foo"), item("bar")),
|
||||||
|
WithDelegate(itemDelegate{}), WithSize(10, 10))
|
||||||
list.SetStatusBarItemName("connection", "connections")
|
list.SetStatusBarItemName("connection", "connections")
|
||||||
|
|
||||||
expected := "2 connections"
|
expected := "2 connections"
|
||||||
|
|||||||
Reference in New Issue
Block a user