- assets/vendor 全量迁移: fontawesome5→assets/fontawesome5, css→assets/css, js→assets/js/runtime(避开 14 个同名自有文件), img 合并去重→assets/img, fonts→assets/fonts; 删除 assets/vendor - libs 五个与 widgets/third-party 字节相同的库不重复入库, loader paths 改指向 - 运行时切换: _win.uri=assets 根, loader baseUrl=/js/runtime, enlighter 注入 路径同步; PHP 7 个引用文件切换并改名 $zibll_*→$runtime_* - 去品牌: Qinver 头注释/品牌 console.log/演示链接清除, 默认文案中性化 - 功能标识符改名: zib__→aksrt__, zib_ajax→aksrt_ajax, window.zib→ window.aksrtLegacy, zibllblock/*→aksrtblock/*, .zib-widget→.aksrt-panel, .zib-slider→.aksrt-slider, zib_menu_options meta 键等 - 自有 CSS 改名: legacy-utilities/compat-vars/footer shell - admin SPA 重建; 契约测试同步(路径/断言/文件更名) - 例外保留: tests/visual 对照环境与 fixtures 前缀(外部 Zibll 产品引用) 验证: php -l 133 个改动文件通过; runtime 86 个 JS node --check 通过; 契约测试 68/70(2 个失败经 stash 对照确认为存量问题)
57 lines
2.3 KiB
JavaScript
57 lines
2.3 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const test = require('node:test');
|
|
|
|
const root = path.resolve(__dirname, '..', '..');
|
|
const read = (file) => fs.readFileSync(path.join(root, file), 'utf8');
|
|
|
|
test('icon card renderers keep vertical and horizontal legacy DOM contracts separate', () => {
|
|
const helper = read('inc/helpers/aksrt-icon-cards.php');
|
|
const widgets = read('src/WidgetSystem/Renderers/GeneralRenderer.php');
|
|
const header = read('inc/helpers/homepage/header-components.php');
|
|
|
|
assert.match(helper, /<div class="icon-card /);
|
|
assert.match(helper, /<div class="icon-cover-card flex ac /);
|
|
assert.match(helper, /icon-cover-icon badg cir/);
|
|
assert.match(helper, /icon-cover-desc ml10 flex1 px12-sm/);
|
|
assert.doesNotMatch(helper, /aksrt-icon-cover-card/);
|
|
assert.match(widgets, /'customize_icon' => \$card\['customize_icon'\] \?\? ''/);
|
|
assert.match(widgets, /'custom_icon'\s+=> \$card\['custom_icon'\] \?\? ''/);
|
|
assert.match(widgets, /'icon_image'\s+=> \$card\['icon_image'\] \?\? ''/);
|
|
assert.match(header, /empty\(\$card\['custom_icon'\]\)/);
|
|
});
|
|
|
|
test('homepage horizontal cards render fully from legacy CSS with no dedicated stylesheet', () => {
|
|
const baseCss = read('assets/css/frontend/base.css');
|
|
const widgetCss = read('assets/widgets/frontend.css');
|
|
const scripts = read('src/Core/ScriptsPart1b.php');
|
|
|
|
assert.equal(fs.existsSync(path.join(root, 'assets/css/frontend/header-cards.css')), false);
|
|
assert.doesNotMatch(baseCss, /\.icon-cover-card\.aksrt-icon-cover-card/);
|
|
assert.doesNotMatch(baseCss, /\.header-components-card/);
|
|
assert.match(
|
|
baseCss,
|
|
/\.header-slider-card\s+\.icon-cover-card\s*\{[^}]*font-size:\s*12px/s,
|
|
);
|
|
assert.doesNotMatch(scripts, /header-cards/);
|
|
assert.doesNotMatch(widgetCss, /aksrt-widget-icon-cards \.icon-cover-card/);
|
|
});
|
|
|
|
test('header icon-card defaults use bundled Font Awesome icons', () => {
|
|
const defaults = [
|
|
read('src/Admin/Schema/SchemaPageDisplay.php'),
|
|
read('src/Admin/PageConfigMetaBox.php'),
|
|
read('src/Settings/DisplayPageGroups.php'),
|
|
];
|
|
|
|
for (const source of defaults) {
|
|
assert.doesNotMatch(source, /'icon'\s*=>\s*'zibsvg-/);
|
|
for (const icon of ['gem', 'star', 'fire', 'wrench']) {
|
|
assert.match(source, new RegExp(`'icon'\\s*=>\\s*'fa fas fa-${icon}'`));
|
|
}
|
|
}
|
|
});
|