MCPcopy
hub / github.com/moncho/dry / TestTableModel_SelectedRow

Function TestTableModel_SelectedRow

appui/table_model_test.go:98–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestTableModel_SelectedRow(t *testing.T) {
99 cols := []Column{{Title: "Name"}}
100 table := NewTableModel(cols)
101 table.SetSize(80, 25)
102 table.SetRows(makeRows(3))
103
104 row := table.SelectedRow()
105 if row == nil {
106 t.Fatal("expected non-nil selected row")
107 }
108 if row.ID() != "a" {
109 t.Fatalf("expected first row ID 'a', got %q", row.ID())
110 }
111
112 table, _ = table.Update(tea.KeyPressMsg{Code: 'j'})
113 row = table.SelectedRow()
114 if row.ID() != "b" {
115 t.Fatalf("expected second row ID 'b', got %q", row.ID())
116 }
117}
118
119func TestTableModel_Filter(t *testing.T) {
120 cols := []Column{{Title: "Name"}, {Title: "Value"}}

Callers

nothing calls this directly

Calls 7

SetSizeMethod · 0.95
SetRowsMethod · 0.95
SelectedRowMethod · 0.95
UpdateMethod · 0.95
NewTableModelFunction · 0.85
makeRowsFunction · 0.85
IDMethod · 0.65

Tested by

no test coverage detected