Files
CN_Tool_client/frontend/src/views/steady/steadyTrend/contracts/check-selection-contract.mjs
yexb 055e69fff7 feat(steady): 完善稳态数据视图功能
- 更新纵坐标刻度算法,优化小数趋势图范围显示
- 添加稳态趋势图全屏模式和共享工具组件
- 实现多图联动的鼠标悬停竖线同步功能
- 调整主线线宽分档策略,降低最大线宽限制
- 重构稳态趋势工具栏,优化谐波次数选择逻辑
- 添加周时间周期搜索支持和自定义时间范围选择
- 完善稳态数据表格和指示器浮动面板功能
- 优化稳态趋势图性能,添加LTB采样和动画控制
- 修复数据表格打开前的趋势数据验证问题
- 统一时间轴标签格式化和网格对齐处理
2026-05-27 08:06:12 +08:00

74 lines
2.6 KiB
JavaScript

/* eslint-env node */
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const currentDir = path.dirname(fileURLToPath(import.meta.url))
const componentDir = path.join(currentDir, '..', 'components')
const read = file => fs.readFileSync(path.join(componentDir, file), 'utf8')
const pageSource = fs.readFileSync(path.join(currentDir, '..', 'index.vue'), 'utf8')
const selectionRulesSource = fs.readFileSync(path.join(currentDir, '..', 'utils', 'selectionRules.ts'), 'utf8')
const expectations = [
[
'ledger tree excludes half-checked parents when collecting checked nodes',
/getCheckedNodes\(\s*false\s*,\s*false\s*\)/,
read('SteadyLedgerTree.vue')
],
[
'indicator tree excludes half-checked parents when collecting checked nodes',
/getCheckedNodes\(\s*false\s*,\s*false\s*\)/,
read('SteadyIndicatorTree.vue')
],
[
'selection rules expose the first selectable ledger resolver',
/export const findFirstSelectableLedgerNode/,
selectionRulesSource
],
[
'selection rules expose the first leaf indicator resolver',
/export const findFirstLeafIndicator/,
selectionRulesSource
],
[
'steady page applies default selected ledger keys after ledger tree load',
/defaultLedgerCheckedKeys\.value\s*=/,
pageSource
],
[
'steady page applies default selected indicator keys after indicator tree load',
/defaultIndicatorCheckedKeys\.value\s*=/,
pageSource
],
['ledger tree receives default checked keys', /defaultCheckedKeys/, read('SteadyLedgerTree.vue')],
[
'ledger tree renders level icons',
/<component\s+:is="resolveLedgerIcon\(data\.level\)"/,
read('SteadyLedgerTree.vue')
],
[
'ledger tree resolves icons by ledger level',
/const\s+ledgerIcons[\s\S]*0:[\s\S]*1:[\s\S]*2:[\s\S]*3:/,
read('SteadyLedgerTree.vue')
],
['indicator tree receives default checked keys', /defaultCheckedKeys/, read('SteadyIndicatorTree.vue')],
[
'selection rules dedupe leaf indicators collected from checked parents and children',
/seenIndicatorKeys[\s\S]*node\.indicatorCode[\s\S]*seenIndicatorKeys\.has[\s\S]*seenIndicatorKeys\.add/,
selectionRulesSource
]
]
const failures = expectations.filter(([, pattern, source]) => !pattern.test(source))
if (failures.length) {
console.error('steadyTrend selection contract failed:')
for (const [name] of failures) {
console.error(`- ${name}`)
}
process.exit(1)
}
console.log('steadyTrend selection contract passed')