| ... | ... | @@ -9,11 +9,9 @@ import { |
| 9 | 9 | createThreadJumpHintVisibilityController, |
| 10 | 10 | filterSidebarProjectScopeItems, |
| 11 | 11 | getSidebarThreadIdsToPrewarm, |
| 12 | | getVisibleSidebarThreadIds, |
| 13 | 12 | resolveAdjacentThreadId, |
| 14 | 13 | reduceSidebarProjectScopeMenuState, |
| 15 | 14 | getFallbackThreadIdAfterDelete, |
| 16 | | getVisibleThreadsForProject, |
| 17 | 15 | getProjectSortTimestamp, |
| 18 | 16 | hasUnseenCompletion, |
| 19 | 17 | isContextMenuPointerDown, |
| ... | ... | @@ -27,7 +25,6 @@ import { |
| 27 | 25 | resolveWorkingStartedAt, |
| 28 | 26 | searchSidebarThreadsByTitle, |
| 29 | 27 | formatWorkingDurationLabel, |
| 30 | | shouldNavigateAfterProjectRemoval, |
| 31 | 28 | shouldClearThreadSelectionOnMouseDown, |
| 32 | 29 | shouldRecedeSidebarThread, |
| 33 | 30 | sortLogicalProjectsForSidebar, |
| ... | ... | @@ -84,56 +81,6 @@ describe("animatePinnedLayoutChanges", () => { |
| 84 | 81 | }); |
| 85 | 82 | }); |
| 86 | 83 | |
| 87 | | describe("shouldNavigateAfterProjectRemoval", () => { |
| 88 | | const projectThreads = [{ environmentId: "environment-local", id: "thread-1" }]; |
| 89 | | |
| 90 | | it("navigates away from a draft route owned by the removed project", () => { |
| 91 | | expect( |
| 92 | | shouldNavigateAfterProjectRemoval({ |
| 93 | | routeTarget: { kind: "draft", draftId: "draft-1" as never }, |
| 94 | | projectThreads, |
| 95 | | projectDraftId: "draft-1", |
| 96 | | }), |
| 97 | | ).toBe(true); |
| 98 | | }); |
| 99 | | |
| 100 | | it("does not navigate away from a different draft route", () => { |
| 101 | | expect( |
| 102 | | shouldNavigateAfterProjectRemoval({ |
| 103 | | routeTarget: { kind: "draft", draftId: "draft-2" as never }, |
| 104 | | projectThreads, |
| 105 | | projectDraftId: "draft-1", |
| 106 | | }), |
| 107 | | ).toBe(false); |
| 108 | | }); |
| 109 | | |
| 110 | | it("navigates away from a server thread owned by the removed project", () => { |
| 111 | | expect( |
| 112 | | shouldNavigateAfterProjectRemoval({ |
| 113 | | routeTarget: { |
| 114 | | kind: "server", |
| 115 | | threadRef: { |
| 116 | | environmentId: EnvironmentId.make("environment-local"), |
| 117 | | threadId: ThreadId.make("thread-1"), |
| 118 | | }, |
| 119 | | }, |
| 120 | | projectThreads, |
| 121 | | projectDraftId: null, |
| 122 | | }), |
| 123 | | ).toBe(true); |
| 124 | | }); |
| 125 | | |
| 126 | | it("does not navigate from an unrelated route", () => { |
| 127 | | expect( |
| 128 | | shouldNavigateAfterProjectRemoval({ |
| 129 | | routeTarget: null, |
| 130 | | projectThreads, |
| 131 | | projectDraftId: null, |
| 132 | | }), |
| 133 | | ).toBe(false); |
| 134 | | }); |
| 135 | | }); |
| 136 | | |
| 137 | 84 | describe("archiveSelectedThreadEntries", () => { |
| 138 | 85 | const entries = [{ threadKey: "one" }, { threadKey: "two" }, { threadKey: "three" }] as const; |
| 139 | 86 | const success = { _tag: "Success" } as const; |
| ... | ... | @@ -644,46 +591,6 @@ describe("resolveAdjacentThreadId", () => { |
| 644 | 591 | }); |
| 645 | 592 | }); |
| 646 | 593 | |
| 647 | | describe("getVisibleSidebarThreadIds", () => { |
| 648 | | it("returns only the rendered visible thread order across projects", () => { |
| 649 | | expect( |
| 650 | | getVisibleSidebarThreadIds([ |
| 651 | | { |
| 652 | | renderedThreadIds: [ |
| 653 | | ThreadId.make("thread-12"), |
| 654 | | ThreadId.make("thread-11"), |
| 655 | | ThreadId.make("thread-10"), |
| 656 | | ], |
| 657 | | }, |
| 658 | | { |
| 659 | | renderedThreadIds: [ThreadId.make("thread-8"), ThreadId.make("thread-6")], |
| 660 | | }, |
| 661 | | ]), |
| 662 | | ).toEqual([ |
| 663 | | ThreadId.make("thread-12"), |
| 664 | | ThreadId.make("thread-11"), |
| 665 | | ThreadId.make("thread-10"), |
| 666 | | ThreadId.make("thread-8"), |
| 667 | | ThreadId.make("thread-6"), |
| 668 | | ]); |
| 669 | | }); |
| 670 | | |
| 671 | | it("skips threads from collapsed projects whose thread panels are not shown", () => { |
| 672 | | expect( |
| 673 | | getVisibleSidebarThreadIds([ |
| 674 | | { |
| 675 | | shouldShowThreadPanel: false, |
| 676 | | renderedThreadIds: [ThreadId.make("thread-hidden-2"), ThreadId.make("thread-hidden-1")], |
| 677 | | }, |
| 678 | | { |
| 679 | | shouldShowThreadPanel: true, |
| 680 | | renderedThreadIds: [ThreadId.make("thread-12"), ThreadId.make("thread-11")], |
| 681 | | }, |
| 682 | | ]), |
| 683 | | ).toEqual([ThreadId.make("thread-12"), ThreadId.make("thread-11")]); |
| 684 | | }); |
| 685 | | }); |
| 686 | | |
| 687 | 594 | describe("isContextMenuPointerDown", () => { |
| 688 | 595 | it("treats secondary-button presses as context menu gestures on all platforms", () => { |
| 689 | 596 | expect( |
| ... | ... | @@ -1362,57 +1269,6 @@ describe("resolveProjectStatusIndicator", () => { |
| 1362 | 1269 | }); |
| 1363 | 1270 | }); |
| 1364 | 1271 | |
| 1365 | | describe("getVisibleThreadsForProject", () => { |
| 1366 | | it("includes the active thread even when it falls below the folded preview", () => { |
| 1367 | | const threads = Array.from({ length: 8 }, (_, index) => |
| 1368 | | makeThread({ |
| 1369 | | id: ThreadId.make(`thread-${index + 1}`), |
| 1370 | | title: `Thread ${index + 1}`, |
| 1371 | | }), |
| 1372 | | ); |
| 1373 | | |
| 1374 | | const result = getVisibleThreadsForProject({ |
| 1375 | | threads, |
| 1376 | | activeThreadId: ThreadId.make("thread-8"), |
| 1377 | | isThreadListExpanded: false, |
| 1378 | | previewLimit: 6, |
| 1379 | | }); |
| 1380 | | |
| 1381 | | expect(result.hasHiddenThreads).toBe(true); |
| 1382 | | expect(result.visibleThreads.map((thread) => thread.id)).toEqual([ |
| 1383 | | ThreadId.make("thread-1"), |
| 1384 | | ThreadId.make("thread-2"), |
| 1385 | | ThreadId.make("thread-3"), |
| 1386 | | ThreadId.make("thread-4"), |
| 1387 | | ThreadId.make("thread-5"), |
| 1388 | | ThreadId.make("thread-6"), |
| 1389 | | ThreadId.make("thread-8"), |
| 1390 | | ]); |
| 1391 | | expect(result.hiddenThreads.map((thread) => thread.id)).toEqual([ThreadId.make("thread-7")]); |
| 1392 | | }); |
| 1393 | | |
| 1394 | | it("returns all threads when the list is expanded", () => { |
| 1395 | | const threads = Array.from({ length: 8 }, (_, index) => |
| 1396 | | makeThread({ |
| 1397 | | id: ThreadId.make(`thread-${index + 1}`), |
| 1398 | | }), |
| 1399 | | ); |
| 1400 | | |
| 1401 | | const result = getVisibleThreadsForProject({ |
| 1402 | | threads, |
| 1403 | | activeThreadId: ThreadId.make("thread-8"), |
| 1404 | | isThreadListExpanded: true, |
| 1405 | | previewLimit: 6, |
| 1406 | | }); |
| 1407 | | |
| 1408 | | expect(result.hasHiddenThreads).toBe(true); |
| 1409 | | expect(result.visibleThreads.map((thread) => thread.id)).toEqual( |
| 1410 | | threads.map((thread) => thread.id), |
| 1411 | | ); |
| 1412 | | expect(result.hiddenThreads).toEqual([]); |
| 1413 | | }); |
| 1414 | | }); |
| 1415 | | |
| 1416 | 1272 | function makeProject(overrides: Partial<Project> = {}): Project { |
| 1417 | 1273 | const { defaultModelSelection, ...rest } = overrides; |
| 1418 | 1274 | return { |