diff --git a/mobile/src/session/mobile-bulk-close-sheet-actions.ts b/mobile/src/session/mobile-bulk-close-sheet-actions.ts index 68dee5c2af3..bdce5323a8f 100644 --- a/mobile/src/session/mobile-bulk-close-sheet-actions.ts +++ b/mobile/src/session/mobile-bulk-close-sheet-actions.ts @@ -16,7 +16,7 @@ type BulkCloseSheetDeps = { } /** - * Builds the long-press bulk-close entries (Close Others / Left / Right) shared + * Builds the long-press bulk-close entries (Close Others / Left) shared * by every session tab sheet. Lives outside the session route to keep the * orchestration out of its max-lines budget; anchors are passed by tab id so * sheets never need the full tab object. diff --git a/mobile/src/session/mobile-tab-close-selection.test.ts b/mobile/src/session/mobile-tab-close-selection.test.ts index df47a6d6513..992e0074884 100644 --- a/mobile/src/session/mobile-tab-close-selection.test.ts +++ b/mobile/src/session/mobile-tab-close-selection.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { selectBulkCloseTabs } from './mobile-tab-close-selection' +import { BULK_TAB_CLOSE_ACTIONS, selectBulkCloseTabs } from './mobile-tab-close-selection' const tab = (id: string, isDirty?: boolean, isPinned?: boolean) => ({ id, @@ -10,6 +10,13 @@ const tab = (id: string, isDirty?: boolean, isPinned?: boolean) => ({ describe('selectBulkCloseTabs', () => { const tabs = [tab('a'), tab('b'), tab('c'), tab('d')] + it('offers only close-others and close-left actions', () => { + expect(BULK_TAB_CLOSE_ACTIONS).toEqual([ + { mode: 'others', label: 'Close Other Tabs' }, + { mode: 'left', label: 'Close Tabs to the Left' } + ]) + }) + it('selects every tab except the anchor for mode "others"', () => { expect(selectBulkCloseTabs(tabs, 'b', 'others').map((t) => t.id)).toEqual(['a', 'c', 'd']) }) @@ -18,13 +25,8 @@ describe('selectBulkCloseTabs', () => { expect(selectBulkCloseTabs(tabs, 'c', 'left').map((t) => t.id)).toEqual(['a', 'b']) }) - it('selects tabs after the anchor for mode "right"', () => { - expect(selectBulkCloseTabs(tabs, 'b', 'right').map((t) => t.id)).toEqual(['c', 'd']) - }) - - it('returns empty when the anchor is at the edge', () => { + it('returns empty when the anchor is at the left edge', () => { expect(selectBulkCloseTabs(tabs, 'a', 'left')).toEqual([]) - expect(selectBulkCloseTabs(tabs, 'd', 'right')).toEqual([]) }) it('returns empty when the anchor is not in the list', () => { diff --git a/mobile/src/session/mobile-tab-close-selection.ts b/mobile/src/session/mobile-tab-close-selection.ts index 1362173beef..11829e0cb3b 100644 --- a/mobile/src/session/mobile-tab-close-selection.ts +++ b/mobile/src/session/mobile-tab-close-selection.ts @@ -1,10 +1,9 @@ -export type BulkTabCloseMode = 'others' | 'left' | 'right' +export type BulkTabCloseMode = 'others' | 'left' /** Long-press sheet entries, in display order. */ export const BULK_TAB_CLOSE_ACTIONS: { mode: BulkTabCloseMode; label: string }[] = [ { mode: 'others', label: 'Close Other Tabs' }, - { mode: 'left', label: 'Close Tabs to the Left' }, - { mode: 'right', label: 'Close Tabs to the Right' } + { mode: 'left', label: 'Close Tabs to the Left' } ] type BulkClosableTab = { @@ -15,7 +14,7 @@ type BulkClosableTab = { /** * Pick the tabs a long-press bulk close ("Close Other Tabs" / "Close Tabs to - * the Left/Right") should target, in strip order relative to the pressed tab. + * the Left") should target, in strip order relative to the pressed tab. * Dirty documents are skipped — mobile has no save prompt on close, so bulk * closing must never silently discard unsaved edits. */ @@ -31,8 +30,6 @@ export function selectBulkCloseTabs( const candidates = mode === 'others' ? tabs.filter((_, index) => index !== anchorIndex) - : mode === 'left' - ? tabs.slice(0, anchorIndex) - : tabs.slice(anchorIndex + 1) + : tabs.slice(0, anchorIndex) return candidates.filter((tab) => tab.isDirty !== true && tab.isPinned !== true) }