feat(canvas): 自由画布 - 增强空白起点、外观设置与节点连接体验 (#356)

This commit is contained in:
vv-get-ti
2026-08-31 06:49:43 +08:00
committed by GitHub
parent 955e4964e9
commit 9e718fcf4a
22 changed files with 925 additions and 113 deletions

View File

@@ -0,0 +1,21 @@
import { describe, expect, test } from "bun:test";
import { resolveCanvasEmptyStateKind } from "../src/lib/canvas/canvas-starter";
describe("canvas starter", () => {
test("offers the guided entry for a new short-drama canvas", () => {
expect(resolveCanvasEmptyStateKind({ nodeCount: 0, shortDramaEnabled: true, isProjectLinked: false })).toBe("guided");
});
test("persists the freeform choice while the canvas remains empty", () => {
expect(resolveCanvasEmptyStateKind({ nodeCount: 0, shortDramaEnabled: true, isProjectLinked: false, starterMode: "freeform" })).toBe("freeform");
});
test("keeps linked projects on their project-specific empty state", () => {
expect(resolveCanvasEmptyStateKind({ nodeCount: 0, shortDramaEnabled: true, isProjectLinked: true, starterMode: "freeform" })).toBe("linked");
});
test("hides every starter after the first node is created", () => {
expect(resolveCanvasEmptyStateKind({ nodeCount: 1, shortDramaEnabled: true, isProjectLinked: false, starterMode: "freeform" })).toBe("none");
});
});