test(canvas): guard PSD template toolbar entry

This commit is contained in:
134 2026-08-13 16:32:25 +08:00
parent 4bb5d3b9f2
commit daad7cbcef
2 changed files with 27 additions and 0 deletions

View File

@ -12,6 +12,7 @@ export default defineConfig({
/routes\/settings-visual-consistency\.test\.ts/,
/routes\/canvas-scale-adjust-intent\.test\.ts/,
/routes\/canvas-runtime-internal-endpoint\.test\.ts/,
/routes\/canvas-psd-template-entry\.test\.ts/,
/routes\/model-classification\.test\.ts/,
/routes\/clawd-request-lifecycle\.test\.ts/,
/routes\/canvas-skill-tag-order\.test\.ts/,

View File

@ -0,0 +1,26 @@
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { expect, test } from "@playwright/test";
function readSource(path: string) {
return readFileSync(resolve(process.cwd(), path), "utf8");
}
test.describe("canvas PSD template replacement entry", () => {
test("keeps the selected-image toolbar action and launch flow wired", () => {
const imageNode = readSource("components/canvas/nodes/ImageNode.tsx");
const workspace = readSource("components/canvas/CanvasWorkspace.tsx");
expect(imageNode).toContain(
'getCanvasToolbarItem(\n canvasToolbarConfig,\n "imagePsdTemplateReplace"'
);
expect(imageNode).toContain('isSelectedImageActionInline("psdTemplate")');
expect(imageNode).toContain('isSelectedImageActionInMore("psdTemplate")');
expect(imageNode).toContain('handleAction("psd-template")');
expect(imageNode).toContain("handleOpenPsdTemplateReplace");
expect(imageNode).toContain("/psd-template?launch=");
expect(workspace).toContain(
'requestImageNodeAction(selectedImageNodes[0].id, "psd-template")'
);
});
});