fix: canonicalize workspace tab routes and prevent orphan runs

This commit is contained in:
Mohamed Boudra
2026-03-04 17:39:19 +07:00
parent 7578846c27
commit 26ea214d64
16 changed files with 723 additions and 88 deletions
@@ -12,6 +12,8 @@ const metrics = {
tabHorizontalPadding: 12,
estimatedCharWidth: 7,
closeButtonWidth: 22,
compactLabelCharCap: 10,
compactDenseLabelCharCap: 8,
};
describe("computeWorkspaceTabLayout", () => {
@@ -60,4 +62,28 @@ describe("computeWorkspaceTabLayout", () => {
expect(result.mode).toBe("icon");
});
it("keeps compact-with-label mode for realistic desktop width with nine tabs", () => {
const result = computeWorkspaceTabLayout({
viewportWidth: 1180,
tabLabelLengths: [18, 21, 14, 15, 19, 12, 17, 16, 20],
metrics,
});
expect(result.mode).toBe("compact");
expect(result.showLabels).toBe(true);
expect(result.showCloseButtons).toBe(false);
});
it("uses dense compact labels for larger tab counts before icon-only", () => {
const result = computeWorkspaceTabLayout({
viewportWidth: 1100,
tabLabelLengths: [18, 21, 14, 15, 19, 12, 17, 16, 20],
metrics,
});
expect(result.mode).toBe("compact");
expect(result.showLabels).toBe(true);
expect(result.showCloseButtons).toBe(false);
});
});