summaryrefslogtreecommitdiff
path: root/internal/tui/report_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-05 19:32:29 +0200
committerPaul Buetow <paul@buetow.org>2026-03-05 19:32:29 +0200
commit83ae6b0b19a1f5bb18069210700fc81d2f43278a (patch)
treec2d931e79c288df8ff46c52793d4ae35ad21082f /internal/tui/report_test.go
parentb547dc4372175bc54ca3bfdeb215b9734987c669 (diff)
migrate Bubble Tea and Lip Gloss to charm.land v2 APIs
Diffstat (limited to 'internal/tui/report_test.go')
-rw-r--r--internal/tui/report_test.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/internal/tui/report_test.go b/internal/tui/report_test.go
index 2bde9ff..e37a209 100644
--- a/internal/tui/report_test.go
+++ b/internal/tui/report_test.go
@@ -5,21 +5,20 @@ import (
"testing"
"codeberg.org/snonux/timesamurai/internal/worktime"
- tea "github.com/charmbracelet/bubbletea"
)
func TestReportWeekNavigation(t *testing.T) {
model := NewReportModel(sampleWeeks())
model.SetSize(120, 12)
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{']'}})
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'w'}})
+ model, _ = model.Update(keyRune(']'))
+ model, _ = model.Update(keyRune('w'))
if model.weekIndex != 1 {
t.Fatalf("weekIndex after ]w = %d, want 1", model.weekIndex)
}
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'['}})
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'w'}})
+ model, _ = model.Update(keyRune('['))
+ model, _ = model.Update(keyRune('w'))
if model.weekIndex != 0 {
t.Fatalf("weekIndex after [w = %d, want 0", model.weekIndex)
}
@@ -29,23 +28,23 @@ func TestReportScrollingAndTopBottom(t *testing.T) {
model := NewReportModel(sampleWeeks())
model.SetSize(120, 12)
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'j'}})
+ model, _ = model.Update(keyRune('j'))
if model.cursor != 1 {
t.Fatalf("cursor after j = %d, want 1", model.cursor)
}
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'k'}})
+ model, _ = model.Update(keyRune('k'))
if model.cursor != 0 {
t.Fatalf("cursor after k = %d, want 0", model.cursor)
}
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'G'}})
+ model, _ = model.Update(keyRune('G'))
if model.cursor != model.rowCount()-1 {
t.Fatalf("cursor after G = %d, want %d", model.cursor, model.rowCount()-1)
}
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'g'}})
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'g'}})
+ model, _ = model.Update(keyRune('g'))
+ model, _ = model.Update(keyRune('g'))
if model.cursor != 0 {
t.Fatalf("cursor after gg = %d, want 0", model.cursor)
}
@@ -55,7 +54,7 @@ func TestReportVerboseToggle(t *testing.T) {
model := NewReportModel(sampleWeeks())
model.SetSize(120, 12)
- model, _ = model.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'v'}})
+ model, _ = model.Update(keyRune('v'))
if !model.verbose {
t.Fatal("verbose = false, want true after v")
}