fix(works): use default typography for card descriptions and growth
douyin-release-gate / verify (push) Failing after 20m18s

This commit is contained in:
2026-10-07 20:12:20 +08:00
parent 26fa98d907
commit 739f3f4d1e
2 changed files with 26 additions and 3 deletions
+1 -3
View File
@@ -361,7 +361,7 @@ export default function WorksGallery({ sourceId, sourceType, emptyHint, extraFil
</Typography.Paragraph>
) : null}
{work.body ? (
<Typography.Paragraph type="secondary" ellipsis={{ rows: 2, tooltip: true }} style={{ fontSize: 12, marginBottom: 0 }}>
<Typography.Paragraph ellipsis={{ rows: 2, tooltip: true }} style={{ marginBottom: 0 }}>
{work.body}
</Typography.Paragraph>
) : null}
@@ -372,11 +372,9 @@ export default function WorksGallery({ sourceId, sourceType, emptyHint, extraFil
</div>
{work.likes_growth != null || extraFilters?.growth_hours ? (
<Typography.Text
type="secondary"
style={{
display: 'block',
padding: '8px 16px 0',
fontSize: 12,
}}
>
<FireOutlined /> 24h 点赞增量 {work.likes_growth == null ? '—' : `+${work.likes_growth}`}
+25
View File
@@ -44,6 +44,31 @@ test('卡片展示作品描述(body 省略两行)', () => {
assert.match(body, /ellipsis=\{\{ rows: 2, tooltip: true \}\}/);
});
for (const [name, tag, content] of [
['作品简介', 'Typography.Paragraph', '{work.body}'],
['24h 点赞增量', 'Typography.Text', 'work.likes_growth == null'],
]) {
test(`卡片${name}使用默认正文字体和字号`, () => {
const matches = [];
function visit(node) {
if (ts.isJsxElement(node)
&& node.openingElement.tagName.getText(source) === tag
&& node.children.some(child => child.getText(source).includes(content))) {
matches.push(node.openingElement);
}
ts.forEachChild(node, visit);
}
visit(source);
assert.equal(matches.length, 1, '应找到对应的卡片文字');
const attributes = matches[0].attributes.properties;
for (const attribute of attributes) {
assert.ok(ts.isJsxAttribute(attribute), '文字不应通过展开属性覆盖默认样式');
assert.ok(!['type', 'strong', 'italic'].includes(attribute.name.getText(source)));
}
assert.doesNotMatch(matches[0].attributes.getText(source), /fontSize|fontFamily|fontWeight|color/);
});
}
function sourceText() {
return source.getFullText();
}