Files
creator-hub/web/tests/table-fixed-header.test.cjs
T
rogee c2bccba352 refactor(web): 删除前端空转链路(任务中心/草稿/attempt/运营工作台/素材面板)
- 删页面目录 tasks/ drafts/ attempts/ creator/workbench/
- 竞品页移除素材处理 Drawer 与素材操作
- metadata 菜单与页头规则同步收敛
- api.ts/listQuery.ts 移除对应 resource 与函数
- 固定表头测试文件清单同步
2026-09-28 15:54:32 +08:00

35 lines
1.4 KiB
JavaScript

const assert = require('node:assert/strict');
const { readFileSync } = require('node:fs');
const { test } = require('node:test');
const ts = require('typescript');
// 表格统一形态:固定表头(scroll.y)+ sticky 兜底 + 横向滚动 + 操作列固定右侧 + 分页。
const files = [
'src/components/accounts/MonitoringAccountList.tsx',
'src/components/accounts/AccountManagementList.tsx',
'src/pages/accounts/import.tsx',
'src/pages/browsers/index.tsx',
'src/pages/network-exits/index.tsx',
'src/pages/gateways/index.tsx',
];
for (const file of files) {
const source = ts.createSourceFile(
file,
readFileSync(`${__dirname}/../${file}`, 'utf8'),
ts.ScriptTarget.Latest,
true,
ts.ScriptKind.TSX,
);
const code = source.getFullText();
test(`${file} 表格使用统一固定表头与分页形态`, () => {
assert.match(code, /sticky/, '应开启表头吸顶兜底');
assert.match(code, /pagination=\{tablePagination\(\)\}/, '应恢复分页(每页 20,单页隐藏)');
assert.doesNotMatch(code, /pagination=\{false\}/, '不应再保留 pagination={false}');
assert.match(code, /\.\.\.fixedLeft</, '首列应固定在左侧');
assert.match(code, /\.\.\.fixedRight</, '操作列应固定在右侧');
assert.match(code, /useOverflowGrid\(/, '应按数据量按需开启表内滚动/横向滚动');
});
}