feat(web): 监控账号详情展示获赞与作者介绍——介绍单行省略,「更多」hover 弹出全文
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const { readFileSync } = require('node:fs');
|
||||
const { test } = require('node:test');
|
||||
const ts = require('typescript');
|
||||
|
||||
const source = ts.createSourceFile(
|
||||
'index.tsx',
|
||||
readFileSync(`${__dirname}/../src/pages/accounts/monitoring/$id/index.tsx`, 'utf8'),
|
||||
ts.ScriptTarget.Latest,
|
||||
true,
|
||||
ts.ScriptKind.TSX,
|
||||
);
|
||||
const code = source.getFullText();
|
||||
|
||||
test('监控账号详情展示获赞与作者介绍', () => {
|
||||
assert.ok(code.includes('total_favorited'), '接口类型应包含 total_favorited');
|
||||
assert.ok(code.includes("competitor.signature"), '接口类型应包含 signature');
|
||||
assert.ok(code.includes("label: '获赞'"), 'Descriptions 应有获赞项');
|
||||
assert.ok(code.includes("label: '作者介绍'"), 'Descriptions 应有作者介绍项');
|
||||
assert.ok(code.includes('formatCount(competitor.total_favorited)'), '获赞应走 formatCount');
|
||||
});
|
||||
|
||||
test('作者介绍单行展示,结尾「更多」hover 弹出全文', () => {
|
||||
// 单行省略:Typography.Text ellipsis
|
||||
assert.match(code, /<Typography\.Text[^>]*ellipsis/, '作者介绍应为单行省略文本');
|
||||
// 更多触发器 + Popover 展示全文,保留换行
|
||||
assert.match(code, /<Popover\b/, '应使用 Popover 承载全文');
|
||||
assert.match(code, />更多</, '结尾应有「更多」触发器');
|
||||
assert.match(code, /pre-wrap/, '全文应保留换行');
|
||||
// 无签名时展示占位符,不渲染更多入口
|
||||
assert.match(code, /competitor\.signature \?/, '签名应判空');
|
||||
});
|
||||
Reference in New Issue
Block a user