test(diy-card): 按自绘架构收敛 show.vue 的契约断言到 self.vue
diy-card-show.vue 自 2026-10-21 起改为自绘(不再经 miniConfig 复用 diy-card-mini 通用布局), 配置由 computed 直读 this.c, 不持有 v 数据对象; 故将假定 show.vue 走 miniConfig/v 对象架构的契约断言(2.17 字号透传、 2.19 actVis/actLabels/actOrder/customActs 透传)收敛到仍走该架构的 diy-card-self.vue。diy-card-mini.vue 的 acts 合成与远端特性保持不变。
This commit is contained in:
@@ -5,8 +5,9 @@
|
||||
* 兼容铁律: 新字段默认值 = 历史形态(plain/chips/关), 存量组件行缺字段时基件
|
||||
* flagOn/normalize 回落历史默认 —— 渲染零变化, 种子只补缺绝不 UPDATE
|
||||
*
|
||||
* 同时锁死 2.17 修复: show.vue miniConfig 补齐 7 个字号字段透传
|
||||
* (此前 show 漏传, 面板配置字号不生效; self 已有)
|
||||
* 同时锁死 2.17 修复: self.vue miniConfig 补齐 7 个字号字段透传
|
||||
* (diy-card-show.vue 自 2026-10-21 起改为自绘, 不再经 miniConfig 复用 diy-card-mini,
|
||||
* 配置由 computed 直读 this.c, 故仅对仍走 v 对象架构的 self.vue 锁死透传)
|
||||
*/
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
@@ -248,22 +249,23 @@ test('复审修复(2.17 review): corner 让位计 theme 头高 / 圆角仅底部
|
||||
assert.match(src, /\.mini-headtheme & \{[\s\S]*?text-shadow/, 'text-shadow 限定 theme 档');
|
||||
});
|
||||
|
||||
test('show.vue/self.vue: miniConfig 透传 8 个新字段; show 补齐 7 个字号(2.17 修复)', () => {
|
||||
test('self.vue: miniConfig 透传 8 个新字段 + 7 个字号(2.17 修复)', () => {
|
||||
// 注: diy-card-show.vue 自 2026-10-21 起改为自绘, 不再经 miniConfig 复用 diy-card-mini 通用布局,
|
||||
// 配置由 computed 直读 this.c 消费, 不持有 v 数据对象; 故仅对仍走 v 对象架构的 self.vue 锁死透传。
|
||||
const sizes = ['nameSize', 'cardTitleSize', 'subSize', 'labelSize', 'valueSize', 'actSize', 'btnSize'];
|
||||
const v2 = Object.keys(V2_FIELDS);
|
||||
for (const file of ['diy-card-show.vue', 'diy-card-self.vue']) {
|
||||
const src = readFileSync(resolve(FE, file), 'utf8');
|
||||
for (const f of v2) {
|
||||
assert.match(src, new RegExp(f + ':\\s*v\\.' + f + ','), file + ' 透传 ' + f);
|
||||
}
|
||||
// 2.18: 6 个新字段透传
|
||||
for (const f of Object.keys(V18_FIELDS).concat(['actIcons'])) {
|
||||
assert.match(src, new RegExp(f + ':\\s*v\\.' + f + ','), file + ' 透传 ' + f);
|
||||
}
|
||||
const file = 'diy-card-self.vue';
|
||||
const src = readFileSync(resolve(FE, file), 'utf8');
|
||||
for (const f of v2) {
|
||||
assert.match(src, new RegExp(f + ':\\s*v\\.' + f + ','), file + ' 透传 ' + f);
|
||||
}
|
||||
const show = readFileSync(resolve(FE, 'diy-card-show.vue'), 'utf8');
|
||||
// 2.18: 6 个新字段透传
|
||||
for (const f of Object.keys(V18_FIELDS).concat(['actIcons'])) {
|
||||
assert.match(src, new RegExp(f + ':\\s*v\\.' + f + ','), file + ' 透传 ' + f);
|
||||
}
|
||||
// 2.17: 7 个字号字段透传(可配置字号)
|
||||
for (const f of sizes) {
|
||||
assert.match(show, new RegExp(f + ':\\s*v\\.' + f + ','), 'show.vue 补齐字号透传 ' + f);
|
||||
assert.match(src, new RegExp(f + ':\\s*v\\.' + f + ','), file + ' 补齐字号透传 ' + f);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -505,7 +507,8 @@ test('mini.vue: acts 合成(显隐过滤 + 次序 + 文案覆盖 + 自定义动
|
||||
assert.match(src, /actSvgOf\(act\)\s*\{[\s\S]*?!this\.actImgOf\(act\) && !this\.actLibOf\(act\) && !!WAP_LINE_ICONS/, '线稿档被 img/素材库优先占位后不再进入');
|
||||
assert.match(src, /import \{[\s\S]*?normalizeActVis, normalizeActLabels, normalizeCustomActs, normalizeActOrder, libIconBg/, 'mini.vue 引入 2.19+2.19.1 依赖');
|
||||
// 透传
|
||||
for (const file of ['diy-card-show.vue', 'diy-card-self.vue']) {
|
||||
// show.vue 自绘, 不持有 v 对象; actVis/actLabels/actOrder/customActs 透传仅校验 self.vue(走 v 架构)
|
||||
for (const file of ['diy-card-self.vue']) {
|
||||
const vue = readFileSync(resolve(FE, file), 'utf8');
|
||||
for (const f of ['actVis', 'actLabels', 'actOrder', 'customActs']) {
|
||||
assert.match(vue, new RegExp(f + ': v\\.' + f + ','), file + ' 透传 ' + f);
|
||||
|
||||
Reference in New Issue
Block a user