|
@@ -49,3 +49,17 @@ test('value-first 四卡读数统一字号,不再按每张卡的文本长度
|
|
|
}
|
|
}
|
|
|
assert.ok(readingRules.some(([, body]) => /font-size:\s*min\(calc\(22 \* var\(--u, 1px\)\), 34cqw\)/.test(body)))
|
|
assert.ok(readingRules.some(([, body]) => /font-size:\s*min\(calc\(22 \* var\(--u, 1px\)\), 34cqw\)/.test(body)))
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+test('value-first 四卡标签统一字号,不再按标签字数各自缩字号', () => {
|
|
|
|
|
+ const source = readFileSync(new URL('../src/modules/cockpit/components/PanelBlocks.vue', import.meta.url), 'utf8')
|
|
|
|
|
+ const style = source.match(/<style[^>]*>([\s\S]*?)<\/style>/)[1]
|
|
|
|
|
+ const labelRules = style
|
|
|
|
|
+ .split('}')
|
|
|
|
|
+ .map((rule) => rule.split('{'))
|
|
|
|
|
+ .filter(([selector, body]) => body && /panel-kpi--value-first/.test(selector) && /panel-kpi__label\b/.test(selector))
|
|
|
|
|
+ assert.ok(labelRules.length > 0, '应有 value-first 标签规则')
|
|
|
|
|
+ for (const [selector, body] of labelRules) {
|
|
|
|
|
+ assert.doesNotMatch(body, /--kpi-label-em|--kpi-label-gutter-u/, `这条规则仍按标签字数收字号:${selector.trim()}`)
|
|
|
|
|
+ }
|
|
|
|
|
+ assert.ok(labelRules.some(([, body]) => /font-size:\s*var\(--fs-caption/.test(body)))
|
|
|
|
|
+})
|