feat: 完善模板内容后台配置能力
This commit is contained in:
1 parent
2bc2193b44
commit
9266ec824a
37 files changed
+2273
-63
No files matched your search
@@ -56,3 +56,55 @@ const unsafe = applyPresentationValues(
|
||||
|
||||
assert.deepEqual(unsafe, { founder: "原主理人" });
|
||||
assert.equal({}.polluted, undefined);
|
||||
|
||||
const listFields = [
|
||||
{
|
||||
key: "details",
|
||||
fields: [
|
||||
{ key: "coverage", binding: "brand.config.profilePresentation.coverage", input: "list" },
|
||||
{
|
||||
key: "warranty",
|
||||
binding: "brand.config.profilePresentation.warranty",
|
||||
input: "list",
|
||||
itemValueKey: "value",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
const existingLists = {
|
||||
profilePresentation: {
|
||||
coverage: [{ title: "原区域", content: "原说明" }],
|
||||
warranty: ["原承诺"],
|
||||
other: "保留",
|
||||
},
|
||||
};
|
||||
assert.deepEqual(
|
||||
readPresentationValue(
|
||||
existingLists,
|
||||
"brand.config.profilePresentation.warranty",
|
||||
listFields[0].fields[1],
|
||||
),
|
||||
[{ value: "原承诺" }],
|
||||
);
|
||||
const updatedLists = applyPresentationValues(existingLists, listFields, {
|
||||
[presentationFieldName("details", "coverage")]: [{ title: "新区域", content: "新说明" }],
|
||||
[presentationFieldName("details", "warranty")]: [{ value: "新承诺" }, { value: "" }],
|
||||
});
|
||||
assert.deepEqual(updatedLists.profilePresentation.coverage, [
|
||||
{ title: "新区域", content: "新说明" },
|
||||
]);
|
||||
assert.deepEqual(updatedLists.profilePresentation.warranty, ["新承诺"]);
|
||||
assert.equal(updatedLists.profilePresentation.other, "保留");
|
||||
assert.deepEqual(existingLists.profilePresentation.warranty, ["原承诺"]);
|
||||
|
||||
const offering = applyPresentationValues(
|
||||
{ details: { background: "旧背景", preserve: "保留" } },
|
||||
[
|
||||
{
|
||||
key: "offering",
|
||||
fields: [{ key: "background", binding: "offering.config.details.background" }],
|
||||
},
|
||||
],
|
||||
{ [presentationFieldName("offering", "background")]: "新背景" },
|
||||
);
|
||||
assert.deepEqual(offering.details, { background: "新背景", preserve: "保留" });
|
||||
Reference in new issue
Block a user