- {tabs.map((tab, index) => (
-
onSwitchTab(tab.entry.path)}
- onClose={() => onCloseTab(tab.entry.path)}
- onDoubleClick={() => onRenameTab && setEditingPath(tab.entry.path)}
- onRenameSave={(newTitle) => { setEditingPath(null); onRenameTab?.(tab.entry.path, newTitle) }}
- onRenameCancel={() => setEditingPath(null)}
- dragProps={{
- onDragStart: (e) => handleDragStart(e, index),
- onDragEnd: handleDragEnd,
- onDragOver: (e) => handleDragOver(e, index),
- onDrop: handleDrop,
- }}
- />
- ))}
-
+
+ {tabs.map((tab, index) => (
+
onSwitchTab(tab.entry.path)}
+ onClose={() => onCloseTab(tab.entry.path)}
+ onDoubleClick={() => onRenameTab && setEditingPath(tab.entry.path)}
+ onRenameSave={(newTitle) => { setEditingPath(null); onRenameTab?.(tab.entry.path, newTitle) }}
+ onRenameCancel={() => setEditingPath(null)}
+ dragProps={{
+ onDragStart: (e) => handleDragStart(e, index),
+ onDragEnd: handleDragEnd,
+ onDragOver: (e) => handleDragOver(e, index),
+ onDrop: handleDrop,
+ }}
+ />
+ ))}
+
+
)
diff --git a/src/test/setup.ts b/src/test/setup.ts
index 898a1f2e..e0b56cd8 100644
--- a/src/test/setup.ts
+++ b/src/test/setup.ts
@@ -5,6 +5,13 @@ import { createElement, type ReactNode, type ComponentType } from 'react'
// Mock scrollIntoView for jsdom (not implemented)
Element.prototype.scrollIntoView = vi.fn()
+// Mock ResizeObserver for jsdom (not implemented)
+global.ResizeObserver = class {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+} as unknown as typeof ResizeObserver
+
// Mock @tauri-apps/plugin-opener for test environment
vi.mock('@tauri-apps/plugin-opener', () => ({
openUrl: vi.fn(),
diff --git a/src/utils/tabLayout.ts b/src/utils/tabLayout.ts
new file mode 100644
index 00000000..56ef1c04
--- /dev/null
+++ b/src/utils/tabLayout.ts
@@ -0,0 +1,5 @@
+/** Compute per-tab max-width so all tabs fit within the container. */
+export function computeTabMaxWidth(containerWidth: number, tabCount: number): number {
+ if (tabCount === 0) return 360
+ return Math.max(60, Math.min(360, Math.floor(containerWidth / tabCount)))
+}