(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func TestAutoFollow_QueuedToActiveTransition(t *testing.T) { |
| 88 | // Test that transitioning from Queued to Active (via DownloadStartedMsg) |
| 89 | // also triggers auto-follow if we are currently on Queued tab. |
| 90 | dm := NewDownloadModel("id-1", "http://example.com", "file", 100) |
| 91 | // Initially it's queued (done=false, paused=false, speed=0, connections=0) |
| 92 | |
| 93 | m := RootModel{ |
| 94 | activeTab: TabQueued, |
| 95 | pinnedTab: -1, |
| 96 | downloads: []*DownloadModel{dm}, |
| 97 | list: NewDownloadList(80, 20), |
| 98 | logViewport: viewport.New(viewport.WithWidth(40), viewport.WithHeight(5)), |
| 99 | } |
| 100 | |
| 101 | // Update list to reflect initial state |
| 102 | m.UpdateListItems() |
| 103 | |
| 104 | msg := events.DownloadStartedMsg{ |
| 105 | DownloadID: "id-1", |
| 106 | Filename: "file", |
| 107 | Total: 100, |
| 108 | State: types.NewProgressState("id-1", 100), |
| 109 | } |
| 110 | |
| 111 | updated, _ := m.Update(msg) |
| 112 | m2 := updated.(RootModel) |
| 113 | |
| 114 | if m2.activeTab != TabActive { |
| 115 | t.Errorf("Expected auto-follow to Active tab, got %d", m2.activeTab) |
| 116 | } |
| 117 | } |
nothing calls this directly
no test coverage detected