Polish compact workspace header actions

This commit is contained in:
Mohamed Boudra
2026-05-25 19:50:31 +07:00
parent e312e0d6f3
commit f0730d5eac
3 changed files with 124 additions and 44 deletions
@@ -13,7 +13,7 @@ const { theme, startWorkspaceScriptMock } = vi.hoisted(() => {
const hoistedTheme = {
spacing: { 1: 4, 1.5: 6, 2: 8, 3: 12 },
borderWidth: { 1: 1 },
borderRadius: { md: 6 },
borderRadius: { md: 6, lg: 8 },
fontSize: { xs: 11, sm: 13 },
fontWeight: { normal: "400", medium: "500" },
colors: {
@@ -150,7 +150,15 @@ function script(
const LIVE_TERMINAL_IDS: string[] = ["terminal-script-1"];
function renderScripts(scripts: WorkspaceScriptPayload[]): {
interface RenderScriptsOptions {
hideLabels?: boolean;
presentation?: "split" | "ghost";
}
function renderScripts(
scripts: WorkspaceScriptPayload[],
options: RenderScriptsOptions = {},
): {
rerender: (nextScripts: WorkspaceScriptPayload[]) => Promise<void>;
unmount: () => void;
} {
@@ -172,6 +180,8 @@ function renderScripts(scripts: WorkspaceScriptPayload[]): {
workspaceId="workspace-1"
scripts={nextScripts}
liveTerminalIds={LIVE_TERMINAL_IDS}
hideLabels={options.hideLabels}
presentation={options.presentation}
/>
</QueryClientProvider>
);
@@ -330,4 +340,22 @@ describe("WorkspaceScriptsButton", () => {
theme.colors.foregroundMuted,
);
});
it("removes the trigger caret in ghost presentation", () => {
current = renderScripts([script({ scriptName: "dev" })], {
hideLabels: true,
presentation: "ghost",
});
const trigger = document.querySelector('[data-testid="workspace-scripts-button"]');
expect(trigger?.querySelector('[data-icon="Play"]')?.getAttribute("data-size")).toBe("16");
expect(trigger?.querySelector('[data-icon="ChevronDown"]')).toBeNull();
});
it("keeps the trigger caret in split presentation", () => {
current = renderScripts([script({ scriptName: "dev" })]);
const trigger = document.querySelector('[data-testid="workspace-scripts-button"]');
expect(trigger?.querySelector('[data-icon="ChevronDown"]')).not.toBeNull();
});
});