feat: refine workbench chrome (#761)
* 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
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { computeDialogDefaultStepId } from "./task-create-dialog-defaults";
|
||||
import type { WorkflowSnapshotData } from "@/lib/state/slices/kanban/types";
|
||||
|
||||
function snapshot(workflowId: string): WorkflowSnapshotData {
|
||||
return {
|
||||
workflowId,
|
||||
workflowName: workflowId,
|
||||
steps: [
|
||||
{
|
||||
id: `${workflowId}-later`,
|
||||
title: "Later",
|
||||
color: "gray",
|
||||
position: 2,
|
||||
},
|
||||
{
|
||||
id: `${workflowId}-start`,
|
||||
title: "Start",
|
||||
color: "green",
|
||||
position: 1,
|
||||
is_start_step: true,
|
||||
},
|
||||
],
|
||||
tasks: [],
|
||||
};
|
||||
}
|
||||
|
||||
describe("computeDialogDefaultStepId", () => {
|
||||
it("uses the resolved workflow when falling back to snapshot steps", () => {
|
||||
expect(
|
||||
computeDialogDefaultStepId({
|
||||
selectedWorkflowId: null,
|
||||
workflowId: "provided",
|
||||
fetchedSteps: null,
|
||||
defaultStepId: null,
|
||||
effectiveWorkflowId: "provided",
|
||||
snapshots: {
|
||||
provided: snapshot("provided"),
|
||||
single: snapshot("single"),
|
||||
},
|
||||
}),
|
||||
).toBe("provided-start");
|
||||
});
|
||||
|
||||
it("falls back to the lowest-position snapshot step when no start step exists", () => {
|
||||
expect(
|
||||
computeDialogDefaultStepId({
|
||||
selectedWorkflowId: null,
|
||||
workflowId: "provided",
|
||||
fetchedSteps: null,
|
||||
defaultStepId: null,
|
||||
effectiveWorkflowId: "provided",
|
||||
snapshots: {
|
||||
provided: {
|
||||
workflowId: "provided",
|
||||
workflowName: "provided",
|
||||
steps: [
|
||||
{ id: "provided-2", title: "Two", color: "gray", position: 2 },
|
||||
{ id: "provided-1", title: "One", color: "green", position: 1 },
|
||||
],
|
||||
tasks: [],
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toBe("provided-1");
|
||||
});
|
||||
|
||||
it("ignores a stale default step while a newly selected workflow loads", () => {
|
||||
expect(
|
||||
computeDialogDefaultStepId({
|
||||
selectedWorkflowId: "selected",
|
||||
workflowId: "original",
|
||||
fetchedSteps: null,
|
||||
defaultStepId: "original-start",
|
||||
effectiveWorkflowId: "selected",
|
||||
snapshots: {
|
||||
original: snapshot("original"),
|
||||
selected: snapshot("selected"),
|
||||
},
|
||||
}),
|
||||
).toBe("selected-start");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user