1package app23import (4 "strings"5 "testing"67 tea "charm.land/bubbletea/v2"8 "github.com/FelineStateMachine/puzzletea/store"9 "github.com/FelineStateMachine/puzzletea/ui"10)1112func TestGameViewRequestsMouseCellMotion(t *testing.T) {13 m := model{14 state: gameView,15 session: sessionState{game: &escapeTrackingGame{}},16 }1718 v := m.View()19 if v.MouseMode != tea.MouseModeCellMotion {20 t.Fatalf("MouseMode = %v, want %v", v.MouseMode, tea.MouseModeCellMotion)21 }22 if !v.KeyboardEnhancements.ReportEventTypes {23 t.Fatal("expected keyboard event type reporting to remain enabled")24 }25}2627func TestPlayMenuViewIncludesNotice(t *testing.T) {28 m := model{29 state: playMenuView,30 width: 80,31 height: 24,32 nav: navigationState{33 playMenu: ui.NewMainMenu(nil),34 },35 notice: noticeState{level: noticeLevelError, message: "Could not load puzzle"},36 }37 m = m.initScreen(playMenuView)3839 if got := m.viewContent(); !strings.Contains(got, "Could not load puzzle") {40 t.Fatalf("viewContent() missing notice, got %q", got)41 }42}4344func TestContinueViewStaysAtNaturalTableWidth(t *testing.T) {45 s := openAppTestStore(t)46 if err := s.CreateGame(&store.GameRecord{47 Name: "shadow-trail",48 GameType: "Sudoku",49 Mode: "Medium",50 Status: store.StatusInProgress,51 RunKind: store.RunKindNormal,52 }); err != nil {53 t.Fatal(err)54 }55 table, games := ui.InitContinueTable(s, 30)56 m := model{57 state: continueView,58 width: 140,59 height: 30,60 cont: continueState{table: table, games: games},61 }62 m = m.resizeActiveScreen()6364 if got, want := m.cont.table.Width(), ui.ContinueTableWidth(); got != want {65 t.Fatalf("continue table width = %d, want %d", got, want)66 }67}