feat!: use new bubbletea input api

This commit is contained in:
Ayman Bagabas
2024-07-22 14:57:15 -04:00
parent a9344b5953
commit e6e18e5012
14 changed files with 61 additions and 37 deletions
+1 -1
View File
@@ -152,7 +152,7 @@ var NewModel = New
// Update is the Tea update function which binds keystrokes to pagination.
func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
case tea.KeyPressMsg:
switch {
case key.Matches(msg, m.KeyMap.NextPage):
m.NextPage()
+2 -2
View File
@@ -50,7 +50,7 @@ func TestPrevPage(t *testing.T) {
model.SetTotalPages(tt.totalPages)
model.Page = tt.page
model, _ = model.Update(tea.KeyMsg{Type: tea.KeyLeft, Alt: false, Runes: []rune{}})
model, _ = model.Update(tea.KeyPressMsg{Sym: tea.KeyLeft})
if model.Page != tt.expected {
t.Errorf("PrevPage() = %d, expected %d", model.Page, tt.expected)
}
@@ -75,7 +75,7 @@ func TestNextPage(t *testing.T) {
model.SetTotalPages(tt.totalPages)
model.Page = tt.page
model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRight, Alt: false, Runes: []rune{}})
model, _ = model.Update(tea.KeyPressMsg{Sym: tea.KeyRight})
if model.Page != tt.expected {
t.Errorf("NextPage() = %d, expected %d", model.Page, tt.expected)
}