test(diy-card): 线稿图标 mask+currentColor 契约(2.19.6) — 5 类禁固定色 background-image

This commit is contained in:
2026-10-24 10:15:10 +08:00
parent 549a98204a
commit 7d1349f336

View File

@@ -637,3 +637,17 @@ test('card-act-icon.js: 类名委托修 2.18 选图标 Bug + $set 写回 + 素
}
});
test('card-preview.css: 默认线稿图标 mask+currentColor —— 前景色实时跟随(2.19.6)', () => {
const css = readFileSync(resolve(BE, 'component/view/public/css/card-preview.css'), 'utf8');
// 5 个默认线稿类必须走 mask-image(颜色与图分离) + background-color: currentColor
for (const k of ['tel', 'wx', 'mail', 'web', 'save']) {
const m = css.match(new RegExp('\\.diy-card-mini__act-svg--' + k + '\\s*\\{[^}]*\\}'));
assert.ok(m, '线稿类存在: ' + k);
const block = m[0];
assert.match(block, /mask-image:\s*url\("data:image\/svg\+xml/, k + ' 走 mask-image(非固定色 background-image)');
assert.match(block, /-webkit-mask-image:/, k + ' 带 -webkit 前缀');
assert.match(block, /background-color:\s*currentColor/, k + ' 背景消费 currentColor(跟随内联 color)');
assert.doesNotMatch(block, /background-image:/, k + ' 不再用固定色 background-image(颜色编码在图内改色无效)');
}
});