68c94dfa3a
* docs: define product and design direction * style: establish restrained workbench primitives * refactor: declutter board and task topbars * style: align dockview panel chrome * fix: align task topbar vcs control sizing * refactor: surface integrations navigation * fix: repair integrations and task creation workflow * refactor: include linear in integrations navigation * style: restore familiar workbench tones * fix: add dockview tab breathing room * fix: show configured integration shortcuts * fix: hover open integrations menu * fix: stabilize integrations hover menu * fix: align home and dockview topbars * fix: normalize home topbar controls * fix: compact home topbar height * fix: simplify home chrome and split buttons * fix: move integrations to left chrome * fix: restore home stats shortcut * fix: add dockview tab breathing room * fix: border home stats button * fix: streamline dockview topbar actions * fix: align task split button seam * fix: address review feedback * fix: restore topbar e2e affordances * fix: stabilize workflow e2e isolation * fix: add task topbar action overflow * fix: address PR review feedback
72 lines
1.7 KiB
TypeScript
72 lines
1.7 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { getHiddenTopbarActionIds } from "./topbar-action-overflow";
|
|
|
|
const QUICK_CHAT = "quick-chat";
|
|
const VCS = "vcs";
|
|
const ATTENTION = "attention";
|
|
const TOOLS = "tools";
|
|
|
|
const items = [
|
|
{ id: QUICK_CHAT, priority: 20 },
|
|
{ id: VCS, priority: 100, required: true },
|
|
{ id: ATTENTION, priority: 80 },
|
|
{ id: TOOLS, priority: 10 },
|
|
];
|
|
|
|
const widths = new Map([
|
|
[QUICK_CHAT, 88],
|
|
[VCS, 180],
|
|
[ATTENTION, 160],
|
|
[TOOLS, 120],
|
|
]);
|
|
|
|
describe("getHiddenTopbarActionIds", () => {
|
|
it("keeps every action visible when there is enough width", () => {
|
|
expect(
|
|
getHiddenTopbarActionIds({
|
|
items,
|
|
availableWidth: 600,
|
|
itemWidths: widths,
|
|
gap: 8,
|
|
overflowTriggerWidth: 40,
|
|
}),
|
|
).toEqual([]);
|
|
});
|
|
|
|
it("hides low-priority tools before quick chat or contextual actions", () => {
|
|
expect(
|
|
getHiddenTopbarActionIds({
|
|
items,
|
|
availableWidth: 500,
|
|
itemWidths: widths,
|
|
gap: 8,
|
|
overflowTriggerWidth: 40,
|
|
}),
|
|
).toEqual([TOOLS]);
|
|
});
|
|
|
|
it("hides quick chat before contextual attention actions", () => {
|
|
expect(
|
|
getHiddenTopbarActionIds({
|
|
items,
|
|
availableWidth: 410,
|
|
itemWidths: widths,
|
|
gap: 8,
|
|
overflowTriggerWidth: 40,
|
|
}),
|
|
).toEqual([QUICK_CHAT, TOOLS]);
|
|
});
|
|
|
|
it("keeps required actions inline even when all secondary actions overflow", () => {
|
|
expect(
|
|
getHiddenTopbarActionIds({
|
|
items,
|
|
availableWidth: 230,
|
|
itemWidths: widths,
|
|
gap: 8,
|
|
overflowTriggerWidth: 40,
|
|
}),
|
|
).toEqual([QUICK_CHAT, ATTENTION, TOOLS]);
|
|
});
|
|
});
|