feat: 建立组件化模板预览基线并规划可视化编辑

This commit is contained in:
que01 committed 2026-10-09 12:32:24 +08:00
1 parent c5af790554
commit 0b14b5a814
46 files changed
+1880 -427

No files matched your search

@@ -1,6 +1,7 @@
import assert from "node:assert/strict";
import {
applyPresentationValues,
applyBrandPreviewValues,
filterSectionsForPreviewTarget,
presentationFieldName,
readPresentationValue,
@@ -124,3 +125,26 @@ const offering = applyPresentationValues(
{ [presentationFieldName("offering", "background")]: "新背景" },
);
assert.deepEqual(offering.details, { background: "新背景", preserve: "保留" });
const brandDraft = applyBrandPreviewValues(
{ description: "旧简介", address: "旧地址", config: { visualPresentation: {} } },
{ visualPresentation: {} },
[
{
key: "identity",
fields: [
{ key: "description", binding: "brand.description" },
{ key: "address", binding: "brand.address" },
{ key: "headline", binding: "brand.config.visualPresentation.home.title" },
],
},
],
{
[presentationFieldName("identity", "description")]: "新简介",
[presentationFieldName("identity", "address")]: "新地址",
[presentationFieldName("identity", "headline")]: "新标题",
},
);
assert.equal(brandDraft.description, "新简介");
assert.equal(brandDraft.address, "新地址");
assert.equal(brandDraft.config.visualPresentation.home.title, "新标题");