@@ -28,6 +28,20 @@ import (
2828 "github.com/charmbracelet/x/exp/teatest"
2929 )
3030
31+func quitAndFinalModel(t *testing.T, tm *teatest.TestModel, timeout time.Duration) Model {
32+ t.Helper()
33+ tm.Send(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'q'}})
34+ fm := tm.FinalModel(t, teatest.WithFinalTimeout(timeout))
35+ return fm.(Model)
36+}
37+
38+func programQuitAndFinalModel(t *testing.T, tm *teatest.TestModel, timeout time.Duration) Model {
39+ t.Helper()
40+ _ = tm.Quit()
41+ fm := tm.FinalModel(t, teatest.WithFinalTimeout(timeout))
42+ return fm.(Model)
43+}
44+
3145 // TestIntegration_DashboardNavigation tests up/down key navigation in dashboard
3246 func TestIntegration_DashboardNavigation(t *testing.T) {
3347 m, cleanup := setupTestModel(t)
@@ -68,11 +82,7 @@ func TestIntegration_DashboardNavigation(t *testing.T) {
6882 time.Sleep(200 * time.Millisecond)
6983
7084 // Send quit to exit cleanly
71- tm.Send(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'q'}})
72-
73- // Get final model and verify selection changed
74- fm := tm.FinalModel(t, teatest.WithFinalTimeout(2*time.Second))
75- finalModel := fm.(Model)
85+ finalModel := quitAndFinalModel(t, tm, 2*time.Second)
7686 if finalModel.selectedIdx != 1 {
7787 t.Errorf("after down key: selectedIdx = %d, want 1", finalModel.selectedIdx)
7888 }
@@ -103,8 +113,7 @@ func TestIntegration_DashboardNavigationUp(t *testing.T) {
103113 time.Sleep(100 * time.Millisecond)
104114
105115 // Verify selection moved up
106- fm := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
107- finalModel := fm.(Model)
116+ finalModel := quitAndFinalModel(t, tm, time.Second)
108117 if finalModel.selectedIdx != 0 {
109118 t.Errorf("after up key: selectedIdx = %d, want 0", finalModel.selectedIdx)
110119 }
@@ -116,7 +125,7 @@ func TestIntegration_FocusViewTransition(t *testing.T) {
116125 defer cleanup()
117126
118127 // Create a mysis
119- mysis, _ := m.commander.CreateMysis("test-mysis", "ollama")
128+ _, _ = m.commander.CreateMysis("test-mysis", "ollama")
120129 m.refreshMysisList()
121130
122131 tm := teatest.NewTestModel(
@@ -139,16 +148,6 @@ func TestIntegration_FocusViewTransition(t *testing.T) {
139148 teatest.WithDuration(2*time.Second),
140149 )
141150
142- // Get model state and verify view changed
143- fm1 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
144- model1 := fm1.(Model)
145- if model1.view != ViewFocus {
146- t.Errorf("after Enter: view = %d, want ViewFocus (%d)", model1.view, ViewFocus)
147- }
148- if model1.focusID != mysis.ID() {
149- t.Errorf("after Enter: focusID = %s, want %s", model1.focusID, mysis.ID())
150- }
151-
152151 // Press Escape to return to dashboard
153152 tm.Send(tea.KeyMsg{Type: tea.KeyEsc})
154153
@@ -163,13 +162,12 @@ func TestIntegration_FocusViewTransition(t *testing.T) {
163162 )
164163
165164 // Verify returned to dashboard
166- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
167- model2 := fm2.(Model)
168- if model2.view != ViewDashboard {
169- t.Errorf("after Escape: view = %d, want ViewDashboard (%d)", model2.view, ViewDashboard)
165+ finalModel := quitAndFinalModel(t, tm, time.Second)
166+ if finalModel.view != ViewDashboard {
167+ t.Errorf("after Escape: view = %d, want ViewDashboard (%d)", finalModel.view, ViewDashboard)
170168 }
171- if model2.focusID != "" {
172- t.Errorf("after Escape: focusID = %s, want empty", model2.focusID)
169+ if finalModel.focusID != "" {
170+ t.Errorf("after Escape: focusID = %s, want empty", finalModel.focusID)
173171 }
174172 }
175173
@@ -199,13 +197,6 @@ func TestIntegration_HelpToggle(t *testing.T) {
199197 teatest.WithDuration(2*time.Second),
200198 )
201199
202- // Verify help is shown
203- fm1 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
204- model1 := fm1.(Model)
205- if !model1.showHelp {
206- t.Error("after ? key: showHelp should be true")
207- }
208-
209200 // Press ? again to hide help
210201 tm.Send(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'?'}})
211202
@@ -213,9 +204,8 @@ func TestIntegration_HelpToggle(t *testing.T) {
213204 time.Sleep(200 * time.Millisecond)
214205
215206 // Verify help is hidden
216- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
217- model2 := fm2.(Model)
218- if model2.showHelp {
207+ finalModel := quitAndFinalModel(t, tm, time.Second)
208+ if finalModel.showHelp {
219209 t.Error("after second ? key: showHelp should be false")
220210 }
221211 }
@@ -250,16 +240,6 @@ func TestIntegration_BroadcastInput(t *testing.T) {
250240 teatest.WithDuration(2*time.Second),
251241 )
252242
253- // Verify input mode activated
254- fm1 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
255- model1 := fm1.(Model)
256- if !model1.input.IsActive() {
257- t.Error("after 'b' key: input should be active")
258- }
259- if model1.input.Mode() != InputModeBroadcast {
260- t.Errorf("after 'b' key: input mode = %d, want InputModeBroadcast (%d)", model1.input.Mode(), InputModeBroadcast)
261- }
262-
263243 // Type message characters
264244 testMessage := "Hello swarm"
265245 for _, r := range testMessage {
@@ -281,9 +261,8 @@ func TestIntegration_BroadcastInput(t *testing.T) {
281261 )
282262
283263 // Verify input cleared
284- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(2*time.Second))
285- model2 := fm2.(Model)
286- if model2.input.IsActive() {
264+ finalModel := quitAndFinalModel(t, tm, 2*time.Second)
265+ if finalModel.input.IsActive() {
287266 t.Error("after Enter: input should be inactive")
288267 }
289268 }
@@ -313,21 +292,11 @@ func TestIntegration_MessageInput(t *testing.T) {
313292 t,
314293 tm.Output(),
315294 func(bts []byte) bool {
316- return bytes.Contains(bts, []byte("MESSAGE"))
295+ return bytes.Contains(bts, []byte("Message to mysis"))
317296 },
318297 teatest.WithDuration(2*time.Second),
319298 )
320299
321- // Verify input mode
322- fm1 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
323- model1 := fm1.(Model)
324- if model1.input.Mode() != InputModeMessage {
325- t.Errorf("after 'm' key: input mode = %d, want InputModeMessage (%d)", model1.input.Mode(), InputModeMessage)
326- }
327- if model1.input.TargetID() != mysis.ID() {
328- t.Errorf("after 'm' key: target ID = %s, want %s", model1.input.TargetID(), mysis.ID())
329- }
330-
331300 // Type message
332301 testMessage := "Test message"
333302 for _, r := range testMessage {
@@ -342,15 +311,14 @@ func TestIntegration_MessageInput(t *testing.T) {
342311 t,
343312 tm.Output(),
344313 func(bts []byte) bool {
345- return !bytes.Contains(bts, []byte("MESSAGE"))
314+ return !bytes.Contains(bts, []byte("Message to mysis"))
346315 },
347316 teatest.WithDuration(3*time.Second),
348317 )
349318
350319 // Verify input cleared
351- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(2*time.Second))
352- model2 := fm2.(Model)
353- if model2.input.IsActive() {
320+ finalModel := quitAndFinalModel(t, tm, 2*time.Second)
321+ if finalModel.input.IsActive() {
354322 t.Error("after Enter: input should be inactive")
355323 }
356324 }
@@ -380,13 +348,6 @@ func TestIntegration_NewMysisInput(t *testing.T) {
380348 teatest.WithDuration(2*time.Second),
381349 )
382350
383- // Verify input mode
384- fm1 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
385- model1 := fm1.(Model)
386- if model1.input.Mode() != InputModeNewMysis {
387- t.Errorf("after 'n' key: input mode = %d, want InputModeNewMysis (%d)", model1.input.Mode(), InputModeNewMysis)
388- }
389-
390351 // Type mysis name
391352 mysisName := "new-mysis"
392353 for _, r := range mysisName {
@@ -407,13 +368,12 @@ func TestIntegration_NewMysisInput(t *testing.T) {
407368 )
408369
409370 // Verify mysis was created
410- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(2*time.Second))
411- model2 := fm2.(Model)
412- if len(model2.myses) != 1 {
413- t.Errorf("after creating mysis: myses count = %d, want 1", len(model2.myses))
371+ finalModel := quitAndFinalModel(t, tm, 2*time.Second)
372+ if len(finalModel.myses) != 1 {
373+ t.Errorf("after creating mysis: myses count = %d, want 1", len(finalModel.myses))
414374 }
415- if len(model2.myses) > 0 && model2.myses[0].Name != mysisName {
416- t.Errorf("after creating mysis: name = %s, want %s", model2.myses[0].Name, mysisName)
375+ if len(finalModel.myses) > 0 && finalModel.myses[0].Name != mysisName {
376+ t.Errorf("after creating mysis: name = %s, want %s", finalModel.myses[0].Name, mysisName)
417377 }
418378 }
419379
@@ -442,19 +402,18 @@ func TestIntegration_ConfigProviderInput(t *testing.T) {
442402 t,
443403 tm.Output(),
444404 func(bts []byte) bool {
445- return bytes.Contains(bts, []byte("PROVIDER"))
405+ return bytes.Contains(bts, []byte("Enter provider"))
446406 },
447407 teatest.WithDuration(2*time.Second),
448408 )
449409
450410 // Verify input mode
451- fm1 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
452- model1 := fm1.(Model)
453- if model1.input.Mode() != InputModeConfigProvider {
454- t.Errorf("after 'c' key: input mode = %d, want InputModeConfigProvider (%d)", model1.input.Mode(), InputModeConfigProvider)
411+ finalModel := programQuitAndFinalModel(t, tm, time.Second)
412+ if finalModel.input.Mode() != InputModeConfigProvider {
413+ t.Errorf("after 'c' key: input mode = %d, want InputModeConfigProvider (%d)", finalModel.input.Mode(), InputModeConfigProvider)
455414 }
456- if model1.input.TargetID() != mysisID {
457- t.Errorf("after 'c' key: target ID = %s, want %s", model1.input.TargetID(), mysisID)
415+ if finalModel.input.TargetID() != mysisID {
416+ t.Errorf("after 'c' key: target ID = %s, want %s", finalModel.input.TargetID(), mysisID)
458417 }
459418 }
460419
@@ -482,7 +441,7 @@ func TestIntegration_ConfigModelInput(t *testing.T) {
482441 t,
483442 tm.Output(),
484443 func(bts []byte) bool {
485- return bytes.Contains(bts, []byte("PROVIDER"))
444+ return bytes.Contains(bts, []byte("Enter provider"))
486445 },
487446 teatest.WithDuration(2*time.Second),
488447 )
@@ -501,21 +460,11 @@ func TestIntegration_ConfigModelInput(t *testing.T) {
501460 t,
502461 tm.Output(),
503462 func(bts []byte) bool {
504- return bytes.Contains(bts, []byte("MODEL"))
463+ return bytes.Contains(bts, []byte("Enter model name"))
505464 },
506465 teatest.WithDuration(2*time.Second),
507466 )
508467
509- // Verify transitioned to model input
510- fm1 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
511- model1 := fm1.(Model)
512- if model1.input.Mode() != InputModeConfigModel {
513- t.Errorf("after provider input: mode = %d, want InputModeConfigModel (%d)", model1.input.Mode(), InputModeConfigModel)
514- }
515- if model1.pendingProvider != provider {
516- t.Errorf("after provider input: pendingProvider = %s, want %s", model1.pendingProvider, provider)
517- }
518-
519468 // Type model name
520469 modelName := "test-model"
521470 for _, r := range modelName {
@@ -530,19 +479,18 @@ func TestIntegration_ConfigModelInput(t *testing.T) {
530479 t,
531480 tm.Output(),
532481 func(bts []byte) bool {
533- return !bytes.Contains(bts, []byte("MODEL"))
482+ return !bytes.Contains(bts, []byte("Enter model name"))
534483 },
535484 teatest.WithDuration(2*time.Second),
536485 )
537486
538487 // Verify input cleared and pendingProvider cleared
539- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
540- model2 := fm2.(Model)
541- if model2.input.IsActive() {
488+ finalModel := quitAndFinalModel(t, tm, time.Second)
489+ if finalModel.input.IsActive() {
542490 t.Error("after model input: input should be inactive")
543491 }
544- if model2.pendingProvider != "" {
545- t.Errorf("after model input: pendingProvider = %s, want empty", model2.pendingProvider)
492+ if finalModel.pendingProvider != "" {
493+ t.Errorf("after model input: pendingProvider = %s, want empty", finalModel.pendingProvider)
546494 }
547495 }
548496
@@ -590,8 +538,7 @@ func TestIntegration_InputCancel(t *testing.T) {
590538 )
591539
592540 // Verify input was cancelled
593- fm := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
594- finalModel := fm.(Model)
541+ finalModel := quitAndFinalModel(t, tm, time.Second)
595542 if finalModel.input.IsActive() {
596543 t.Error("after Escape: input should be inactive")
597544 }
@@ -629,8 +576,7 @@ func TestIntegration_WindowResize(t *testing.T) {
629576 )
630577
631578 // Verify dimensions updated
632- fm := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
633- finalModel := fm.(Model)
579+ finalModel := quitAndFinalModel(t, tm, time.Second)
634580 if finalModel.width != newWidth {
635581 t.Errorf("after resize: width = %d, want %d", finalModel.width, newWidth)
636582 }
@@ -679,8 +625,7 @@ func TestIntegration_ViewportScroll(t *testing.T) {
679625 )
680626
681627 // Verify viewport scrolled
682- fm := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
683- finalModel := fm.(Model)
628+ finalModel := quitAndFinalModel(t, tm, time.Second)
684629 if finalModel.viewport.YOffset == 0 && len(finalModel.logs) > finalModel.viewport.Height {
685630 // If there's content to scroll and we're still at offset 0, something is wrong
686631 t.Error("viewport should have scrolled up but YOffset is still 0")
@@ -707,42 +652,22 @@ func TestIntegration_ViewportBounds(t *testing.T) {
707652 defer tm.Quit()
708653
709654 // Try to scroll up when at top
710- initialOffset := m.viewport.YOffset
711655 tm.Send(tea.KeyMsg{Type: tea.KeyUp})
712656
713657 // Wait briefly
714658 time.Sleep(100 * time.Millisecond)
715659
716660 // Verify didn't scroll past bounds
717- fm := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
718- finalModel := fm.(Model)
661+ finalModel := quitAndFinalModel(t, tm, time.Second)
719662 if finalModel.viewport.YOffset < 0 {
720663 t.Errorf("viewport scrolled past top: YOffset = %d", finalModel.viewport.YOffset)
721664 }
722665
723- // Try to scroll down when at bottom (with autoscroll enabled)
724- finalModel.viewport.GotoBottom()
725- finalModel.autoScroll = true
726- bottomOffset := finalModel.viewport.YOffset
727- tm.Send(tea.KeyMsg{Type: tea.KeyDown})
728-
729- // Wait briefly
730- time.Sleep(100 * time.Millisecond)
731-
732- // Verify stayed within bounds
733- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
734- finalModel2 := fm2.(Model)
735- if finalModel2.viewport.YOffset < 0 {
736- t.Errorf("viewport YOffset became negative: %d", finalModel2.viewport.YOffset)
737- }
738-
739666 // Offset should not have increased beyond content
740- if len(finalModel2.logs) > 0 && finalModel2.viewport.YOffset > finalModel2.viewportTotalLines {
667+ if len(finalModel.logs) > 0 && finalModel.viewport.YOffset > finalModel.viewportTotalLines {
741668 t.Errorf("viewport scrolled past content: YOffset = %d, totalLines = %d",
742- finalModel2.viewport.YOffset, finalModel2.viewportTotalLines)
669+ finalModel.viewport.YOffset, finalModel.viewportTotalLines)
743670 }
744- _ = initialOffset // prevent unused warning
745- _ = bottomOffset // prevent unused warning
746671 }
747672
748673 // TestIntegration_MysisStartedEvent tests event updates dashboard
@@ -775,8 +700,7 @@ func TestIntegration_MysisStartedEvent(t *testing.T) {
775700 )
776701
777702 // Verify mysis state updated
778- fm := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
779- finalModel := fm.(Model)
703+ finalModel := quitAndFinalModel(t, tm, time.Second)
780704 finalModel.refreshMysisList()
781705 if len(finalModel.myses) > 0 && finalModel.myses[0].State != "running" {
782706 t.Errorf("after start event: mysis state = %s, want running", finalModel.myses[0].State)
@@ -814,8 +738,7 @@ func TestIntegration_MysisStoppedEvent(t *testing.T) {
814738 )
815739
816740 // Verify mysis state updated
817- fm := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
818- finalModel := fm.(Model)
741+ finalModel := quitAndFinalModel(t, tm, time.Second)
819742 finalModel.refreshMysisList()
820743 if len(finalModel.myses) > 0 && finalModel.myses[0].State == "running" {
821744 t.Errorf("after stop event: mysis state = %s, should not be running", finalModel.myses[0].State)
@@ -854,8 +777,7 @@ func TestIntegration_BroadcastEvent(t *testing.T) {
854777 )
855778
856779 // Verify broadcast appears in swarm messages
857- fm := tm.FinalModel(t, teatest.WithFinalTimeout(2*time.Second))
858- finalModel := fm.(Model)
780+ finalModel := quitAndFinalModel(t, tm, 2*time.Second)
859781 finalModel.refreshSwarmMessages()
860782
861783 found := false
@@ -915,17 +837,6 @@ func TestIntegration_CreateAndStartMysis(t *testing.T) {
915837 teatest.WithDuration(3*time.Second),
916838 )
917839
918- // Verify mysis exists
919- fm := tm.FinalModel(t, teatest.WithFinalTimeout(2*time.Second))
920- finalModel := fm.(Model)
921- finalModel.refreshMysisList()
922- if len(finalModel.myses) != 1 {
923- t.Fatalf("expected 1 mysis, got %d", len(finalModel.myses))
924- }
925- if finalModel.myses[0].Name != mysisName {
926- t.Errorf("mysis name = %s, want %s", finalModel.myses[0].Name, mysisName)
927- }
928-
929840 // Navigate to the mysis and focus
930841 tm.Send(tea.KeyMsg{Type: tea.KeyEnter})
931842
@@ -940,10 +851,16 @@ func TestIntegration_CreateAndStartMysis(t *testing.T) {
940851 )
941852
942853 // Verify in focus view
943- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
944- finalModel2 := fm2.(Model)
945- if finalModel2.view != ViewFocus {
946- t.Errorf("view = %d, want ViewFocus (%d)", finalModel2.view, ViewFocus)
854+ finalModel := quitAndFinalModel(t, tm, time.Second)
855+ finalModel.refreshMysisList()
856+ if len(finalModel.myses) != 1 {
857+ t.Fatalf("expected 1 mysis, got %d", len(finalModel.myses))
858+ }
859+ if finalModel.myses[0].Name != mysisName {
860+ t.Errorf("mysis name = %s, want %s", finalModel.myses[0].Name, mysisName)
861+ }
862+ if finalModel.view != ViewFocus {
863+ t.Errorf("view = %d, want ViewFocus (%d)", finalModel.view, ViewFocus)
947864 }
948865 }
949866
@@ -969,26 +886,29 @@ func TestIntegration_MultipleKeySequence(t *testing.T) {
969886 time.Sleep(100 * time.Millisecond)
970887
971888 tm.Send(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'?'}})
972- time.Sleep(100 * time.Millisecond)
889+ teatest.WaitFor(
890+ t,
891+ tm.Output(),
892+ func(bts []byte) bool {
893+ return bytes.Contains(bts, []byte("COMMAND REFERENCE"))
894+ },
895+ teatest.WithDuration(2*time.Second),
896+ )
973897
974898 tm.Send(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'?'}})
975- time.Sleep(100 * time.Millisecond)
976-
977- tm.Send(tea.KeyMsg{Type: tea.KeyUp})
978-
979- // Wait for final state
980899 teatest.WaitFor(
981900 t,
982901 tm.Output(),
983902 func(bts []byte) bool {
984- return !bytes.Contains(bts, []byte("HELP"))
903+ return !bytes.Contains(bts, []byte("COMMAND REFERENCE"))
985904 },
986905 teatest.WithDuration(2*time.Second),
987906 )
988907
908+ tm.Send(tea.KeyMsg{Type: tea.KeyUp})
909+
989910 // Verify final state: selectedIdx=0, help hidden
990- fm := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
991- finalModel := fm.(Model)
911+ finalModel := quitAndFinalModel(t, tm, time.Second)
992912 if finalModel.selectedIdx != 0 {
993913 t.Errorf("after sequence: selectedIdx = %d, want 0", finalModel.selectedIdx)
994914 }
@@ -1034,13 +954,6 @@ func TestIntegration_VerboseToggle(t *testing.T) {
1034954 teatest.WithDuration(2*time.Second),
1035955 )
1036956
1037- // Verify verboseJSON toggled
1038- fm1 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
1039- model1 := fm1.(Model)
1040- if !model1.verboseJSON {
1041- t.Error("after 'v' key: verboseJSON should be true")
1042- }
1043-
1044957 // Press 'v' again to toggle back
1045958 tm.Send(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'v'}})
1046959
@@ -1055,9 +968,8 @@ func TestIntegration_VerboseToggle(t *testing.T) {
1055968 )
1056969
1057970 // Verify verboseJSON toggled back
1058- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
1059- model2 := fm2.(Model)
1060- if model2.verboseJSON {
971+ finalModel := quitAndFinalModel(t, tm, time.Second)
972+ if finalModel.verboseJSON {
1061973 t.Error("after second 'v' key: verboseJSON should be false")
1062974 }
1063975 }
@@ -1096,22 +1008,8 @@ func TestIntegration_AutoScrollBehavior(t *testing.T) {
10961008 time.Sleep(100 * time.Millisecond)
10971009
10981010 // Verify auto-scroll disabled
1099- fm1 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
1100- model1 := fm1.(Model)
1101- if model1.autoScroll {
1011+ finalModel := quitAndFinalModel(t, tm, time.Second)
1012+ if finalModel.autoScroll {
11021013 t.Error("after scrolling up: autoScroll should be false")
11031014 }
1104-
1105- // Go to bottom - should enable auto-scroll
1106- tm.Send(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'G'}})
1107-
1108- // Wait briefly
1109- time.Sleep(100 * time.Millisecond)
1110-
1111- // Verify auto-scroll enabled
1112- fm2 := tm.FinalModel(t, teatest.WithFinalTimeout(time.Second))
1113- model2 := fm2.(Model)
1114- if !model2.autoScroll {
1115- t.Error("after going to bottom: autoScroll should be true")
1116- }
11171015 }