/g) || []).length, comp + ' template 标签配平');
+ // 资源引用
+ assert.match(html, /js src="\{\$resource_path\}\/\.\.\/public\/js\/card-icon-lib\.js"/, comp + ' 引入素材图标库 JS');
+ assert.match(html, /js src="\{\$resource_path\}\/\.\.\/public\/js\/card-act-icon\.js"/, comp + ' 引入图标选择委托 JS');
+ }
+});
+
+test('card-act-icon.js: 类名委托修 2.18 选图标 Bug + $set 写回 + 素材库唯一图标来源 + 次序调整(2.19+2.19.1)', () => {
+ const src = readFileSync(resolve(BE, 'component/view/public/js/card-act-icon.js'), 'utf8');
+ assert.match(src, /on\('click', '\.js-act-lib'/, '素材图标库走类名委托');
+ assert.doesNotMatch(src, /js-act-media|openAlbum\(function/, '媒体库委托已整体移除(2.19.1 图标唯一来源=素材图标库)');
+ // 2.19.1 默认动作次序调整
+ assert.match(src, /on\('click', '\.js-act-move'/, '次序调整走类名委托');
+ assert.match(src, /var ACT_ORDER_DEF = \['tel', 'wx', 'mail', 'web', 'save'\];/, 'actOrder 白名单默认序');
+ assert.match(src, /function moveAct\(comp, key, dir\)/, 'moveAct 归一化+相邻交换');
+ assert.match(src, /window\.vue\.\$set\(comp, 'actOrder', cur\)/, 'actOrder 写回走 $set(存量行缺键)');
+ assert.match(src, /closest\('\.draggable-element'\)/, '组件实例定位 draggable-element');
+ assert.match(src, /data\('scope'\) \|\| 'default'\) === 'custom'/, 'custom 作用域写 customActs[idx]');
+ assert.match(src, /window\.vue\.\$set\(item, 'iconKey'/, 'iconKey 写回走 $set(存量行缺键)');
+ assert.match(src, /window\.vue\.\$set\(item, 'img'/, 'img 写回走 $set');
+ // svg 快照链路: 选图/改色时由委托 JS 预计算 data URI 写入 svg 字段(预览只读数据)
+ assert.match(src, /function setIcon\(item, patch\)/, 'setIcon 统一写图标');
+ assert.match(src, /window\.cardLibIconBg\(iconKey, currentColor\(item\)\)/, '选图时预计算 svg 快照');
+ assert.match(src, /function actColorHandler\(\$el, field\)/, '改色处理器');
+ assert.match(src, /on\('input', '\.js-act-color'/, '前景/底色走 input 类名委托');
+ assert.match(src, /window\.cardLibIconBg\(target\.item\.iconKey, currentColor\(target\.item\)\)/, '改色时重算 svg 快照(颜色实时生效)');
+ assert.match(src, /iconKey: '', svg: '', color: ''/, '缺行防御补齐含 svg 键');
+ assert.match(src, /window\.CARD_ICON_LIB \|\| \{\}/, '弹层渲染消费同源图标库');
+ assert.match(src, /cal-item" data-key=/, '弹层图标网格');
+ // 反例: 面板不再内联调 openAlbum 选快捷操作图标(2.18 Bug 根因规避)
+ for (const comp of ['show', 'self']) {
+ const html = readFileSync(resolve(BE, 'component/view/diy-card-' + comp + '/design.html'), 'utf8');
+ assert.doesNotMatch(html, /openAlbum\(function \(obj\) \{ if \(obj && obj\.length\) \{ if \(!nc\.actIcons\)/, comp + ' 面板不再内联调 openAlbum 写 actIcons');
+ }
+});
+