fix(web): Web 检查 - 格式化拆分模块并修正源码断言

拆分出的前端模块未按 Prettier 格式化导致 CI 格式检查失败;源码断言改为忽略空白差异,导演台引导组件恢复别名导入。同时移除误提交的分析草稿、pnpm 锁文件和调试测试。
This commit is contained in:
ddcat666
2026-09-30 10:32:17 +08:00
parent 7f5d87ef1a
commit fda3b84277
22 changed files with 1197 additions and 2137 deletions

View File

@@ -131,7 +131,7 @@ describe("creation library button", () => {
const createSource = readCreateWorkspaceSource();
expect(assets).toContain("resolveResourceUrl(asset.data.storageKey");
expect(createSource).toContain("<CachedResourceImage storageKey={item.storageKey}");
expect(createSource.replace(/\s+/g, " ")).toContain("<CachedResourceImage storageKey={item.storageKey}");
expect(createSource).toContain("resolveResourceUrl(item.storageKey, item.previewUrl)");
});

View File

@@ -96,25 +96,27 @@ describe("模式接线", () => {
});
test("骨骼/姿势入口只对演员开放,且由 bones 把关", () => {
expect(workbench).toContain('{capabilities.bones && (object.kind === "actor" || object.primitive === "character") ? <>');
const normalizedWorkbench = workbench.replace(/\s+/g, " ");
expect(normalizedWorkbench).toContain('{capabilities.bones && (object.kind === "actor" || object.primitive === "character") ? ( <>');
// motionClips 不得再作为放行条件:带动画的普通模型不是演员。
expect(workbench).not.toContain('object.primitive === "character" || motionClips.length) ? <>');
});
test("姿态模式提供全身与当前骨骼重置,不删除动画轨道", () => {
const inspector = slice(workbench, "function ObjectInspector(", "function LightInspector(");
expect(inspector).toContain('onClick={() => applyPose("stand")}>重置姿态</Button>');
const normalizedInspector = inspector.replace(/\s+/g, " ");
expect(normalizedInspector).toContain('onClick={() => applyPose("stand")}> 重置姿态 </Button>');
expect(inspector).toContain("delete boneOverrides[selectedBoneId]");
expect(inspector).toContain(">重置当前骨骼</Button>");
expect(normalizedInspector).toContain("> 重置当前骨骼 </Button>");
expect(inspector).not.toContain("boneTracks: []");
});
test("动作片段与骨骼入口解耦:任何带 Clip 的对象都能调播放速度/循环", () => {
expect(workbench).toContain('{motionClips.length ? <><Field label="动作片段">');
expect(workbench.replace(/\s+/g, " ")).toContain('{motionClips.length ? ( <> <Field label="动作片段">');
});
test("关键帧入口由 keyframes 把关", () => {
expect(workbench).toContain("{capabilities.keyframes ? <>");
expect(workbench.replace(/\s+/g, " ")).toContain("{capabilities.keyframes ? ( <>");
});
test("渲染视图下拉按当前模式过滤,而不是写死五项", () => {

View File

@@ -1,11 +0,0 @@
import { test, expect } from "bun:test";
import { applyFrameDrop, buildCanvasFrameDropIndex, findFrameDropTargetFromIndex } from "@/lib/canvas/canvas-frame";
import { CanvasNodeType } from "@/types/canvas";
const frame = { id: "f", type: CanvasNodeType.Frame, title: "f", position: { x: 0, y: 0 }, width: 760, height: 520, metadata: { frame: { collapsed: false, expandedWidth: 760, expandedHeight: 520 } } } as any;
for (const t of [CanvasNodeType.Text, CanvasNodeType.Markdown, CanvasNodeType.Audio, CanvasNodeType.Image]) {
test(t, () => {
const n = { id: "n", type: t, title: "n", position: { x: 100, y: 100 }, width: 340, height: 240, metadata: {} } as any;
const target = findFrameDropTargetFromIndex(buildCanvasFrameDropIndex([frame, n]), [n], new Set(["n"]), { x: 0, y: 0 });
console.log(t, target, applyFrameDrop([frame, n], new Set(["n"]), target).find((x) => x.id === "n")?.parentId);
});
}