24 lines
1.4 KiB
JavaScript
24 lines
1.4 KiB
JavaScript
/**
|
||
* 功能:静态检查资源详情关联表中的设备参数可完整查看且不会撑宽表格。
|
||
* 版本:v1.2.0
|
||
*/
|
||
import assert from 'node:assert/strict';
|
||
import { readFileSync } from 'node:fs';
|
||
|
||
const detail = readFileSync(
|
||
new URL('../src/views/resource/ResourceDetailContent.vue', import.meta.url),
|
||
'utf8',
|
||
);
|
||
|
||
assert.match(detail, /isCollectionJsonField\(definition\.name, collection\.key, column\)/, '关联表 JSON 字段缺少专用展示分支');
|
||
assert.match(detail, />查看参数<\/a-button>/, '设备参数缺少完整查看入口');
|
||
assert.match(detail, /formatCollectionJson\(record\[column\]\)/, '设备参数没有格式化完整内容');
|
||
assert.match(detail, /JSON\.stringify\(JSON\.parse\(text\), null, 2\)/, '字符串 JSON 未格式化');
|
||
assert.match(detail, /isCollectionJsonField\(props\.definition\.name, collectionKey, column\)/, '设备参数列未使用契约化紧凑宽度');
|
||
assert.match(detail, /max-width: min\(560px, 70vw\)/, '参数浮层缺少视口宽度限制');
|
||
assert.match(detail, /class="collection-table-shell"/, '关联表缺少独立宽度约束容器');
|
||
assert.match(detail, /\.detail-stack[\s\S]*?min-width: 0;/, '详情栈仍可能被子内容反向撑宽');
|
||
assert.match(detail, /\.collection-table-shell[\s\S]*?overflow-x: auto;/, '关联表缺少内部横向溢出兜底');
|
||
|
||
console.log('资源详情设备参数检查通过:100% 视口不被关联表撑宽,参数可完整查看。');
|