feat: 增加商品组件
This commit is contained in:
@@ -40,4 +40,25 @@ for (const snippet of forbiddenCompatibilitySnippets) {
|
||||
);
|
||||
}
|
||||
|
||||
const requiredStrictRenderingSnippets = [
|
||||
"LONG_TEXT_KEYS.sceneImage",
|
||||
"LONG_TEXT_KEYS.commodityList",
|
||||
"commodity.commodity_id",
|
||||
"commodity.commodity_name",
|
||||
"commodity.commodity_price",
|
||||
"commodity.commodity_tag",
|
||||
"commodity.commodity_photo",
|
||||
"content-body-list-marker",
|
||||
"entry.value.length > 1",
|
||||
"formatListMarker(index)",
|
||||
];
|
||||
|
||||
for (const snippet of requiredStrictRenderingSnippets) {
|
||||
assert.equal(
|
||||
source.includes(snippet),
|
||||
true,
|
||||
`ParsedValueView should render exact strict field: ${snippet}`
|
||||
);
|
||||
}
|
||||
|
||||
console.log("ParsedValueView strict field checks passed");
|
||||
|
||||
@@ -7,6 +7,8 @@ const moduleUrl = `data:text/javascript;base64,${Buffer.from(source).toString("b
|
||||
const longTextCard = await import(moduleUrl);
|
||||
|
||||
const {
|
||||
LONG_TEXT_FIELD_CONFIG,
|
||||
LONG_TEXT_KEYS,
|
||||
parseLongTextDisplayValue,
|
||||
sanitizeLongTextDisplayValue,
|
||||
hasLongTextDisplayValue,
|
||||
@@ -51,4 +53,23 @@ assert.equal(hasLongTextDisplayValue({ a: "", b: [" ", null] }), false);
|
||||
assert.equal(formatLongTextDisplayValue(true), "\u662f");
|
||||
assert.equal(formatLongTextDisplayValue({ title: "bridge" }), '{"title":"bridge"}');
|
||||
|
||||
const expectedNewKeys = {
|
||||
preparationSectionTitle: "preparation_section_title",
|
||||
preparationSectionItems: "preparation_section_items",
|
||||
sectionSuggestionTitle: "section_suggestion_title",
|
||||
sectionSuggestionContent: "section_suggestion_content",
|
||||
pitfallSectionTitle: "pitfall_section_title",
|
||||
pitfallSectionItems: "pitfall_section_items",
|
||||
commodityList: "commodity_list",
|
||||
};
|
||||
|
||||
for (const [keyName, keyValue] of Object.entries(expectedNewKeys)) {
|
||||
assert.equal(LONG_TEXT_KEYS[keyName], keyValue, `${keyName} should be registered`);
|
||||
assert.equal(
|
||||
LONG_TEXT_FIELD_CONFIG.some((item) => item.key === keyValue),
|
||||
true,
|
||||
`${keyValue} should be in LONG_TEXT_FIELD_CONFIG`
|
||||
);
|
||||
}
|
||||
|
||||
console.log("longTextCard display helpers passed");
|
||||
|
||||
Reference in New Issue
Block a user