mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
feat!: use new bubbletea input api
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user