fix(icons): 图标类名统一为 FA5 语法并修正一处失效图标名
主题打包的是 Font Awesome 5,solid 字形必须带样式类 fas。全站有 18 处仍写成 FA4 的裸 fa fa-*,FA5 下并不存在对应字形,表现为图标位置空白;而 FA5-only 契约此前只扫描部分运行时文件,没有覆盖模板与渲染器,这些写法一直没被拦下。 同时发现一处真实的失效图标名:profile-level.php 用的是 fa-line-chart。这是 FA4 名称,FA5 把该系列重命名为 chart-*,正确写法是 fa-chart-line。 - 18 处 "fa fa-*" 补上 fas:首页模板、组件标记、评论表单、用户等级页、菜单 装饰、SchemaPayment 促销标签默认值、VIP 服务弹窗、ContentRenderer / GeneralRenderer、后台卡片样式校验、pay-vip.js - profile-level.php 的 fa-line-chart 修正为 fa-chart-line - 三处注释里的示例值同步为合法形态("fa fas fa-star"),避免被当成正确写法 抄走;credits.css 注释中直接写出旧字体族名的一处改为描述性表述,否则会被 FA5-only 契约当作违规命中 - legacy-navigation-contract:FA 资产断言改为跟随 aksrt_enqueue_fontawesome() 这一间接层(注册点已从脚本文件移到 inc/helpers/aksrt-icons.php),并把 fa-zibsvg-<key> 识别为项目自有 SVG sprite 族,而非 Font Awesome 字形 - vip-points-exchange-modal 契约同步断言 fa fas fa-angle-right 验证:改动前在干净 HEAD 上跑 node --test(已追踪用例)为 327 项 / 325 通过 / 2 失败,两项失败正是本次修复的失效图标名断言与 FA 版本号断言;改动后 333 项 / 333 通过(含 5 个本地专用用例共 370 项全部通过)。php -l 全部改动的 PHP 文件 通过。
This commit is contained in:
@@ -28,6 +28,13 @@ const scripts = join([
|
||||
'src/Core/ScriptsPart1b.php',
|
||||
'src/Core/ScriptsPart1c.php',
|
||||
]);
|
||||
// The Font Awesome handle is registered inside aksrt_enqueue_fontawesome(), so the
|
||||
// 5.15.4 asset contract has to follow that indirection rather than the enqueue call site.
|
||||
const iconRuntime = join([
|
||||
'src/Core/ScriptsPart1b.php',
|
||||
'src/Core/ScriptsPart1c.php',
|
||||
'inc/helpers/aksrt-icons.php',
|
||||
]);
|
||||
const header = join([
|
||||
'header.php',
|
||||
'inc/helpers/header/aksrt-header-render.php',
|
||||
@@ -42,7 +49,8 @@ test('the public dependency graph uses WordPress jQuery with the local runtime s
|
||||
assert.doesNotMatch(scripts, /wp_deregister_script\('jquery'\)/);
|
||||
assert.doesNotMatch(scripts, /jquery\.min\.js'[\s\S]*?'1\.9\.1'/);
|
||||
assert.match(scripts, /bootstrap\.min\.css'[\s\S]*?'3\.4\.1'/);
|
||||
assert.match(scripts, /fontawesome5'[\s\S]*?all\.min\.css'[\s\S]*?'5\.15\.4'/);
|
||||
assert.match(scripts, /aksrt_enqueue_fontawesome\(/);
|
||||
assert.match(iconRuntime, /fontawesome5\/css\/all\.min\.css'[\s\S]*?'5\.15\.4'/);
|
||||
assert.match(scripts, /main\.min\.css/);
|
||||
assert.match(scripts, /loader\.js'[\s\S]*?\['jquery', 'bootstrap'\]/);
|
||||
assert.match(read('assets/js/runtime/loader.js'), /tbquire\(\['main'\]\)/);
|
||||
@@ -107,6 +115,9 @@ test('Font Awesome 5 is the only icon contract across every runtime path', () =>
|
||||
'fa-chevron', 'fa-icon', 'fa-icon-picker', 'fa-icons', 'fa-input',
|
||||
'fa-mask', 'fa-spin-hover', 'fa-toggle-theme', 'fa-xxx',
|
||||
]);
|
||||
// The theme ships its own SVG sprite family, so fa-zibsvg-<key> is a project
|
||||
// icon rather than a Font Awesome glyph — allow the prefix instead of every key.
|
||||
const projectFamily = /^fa-zibsvg-/;
|
||||
|
||||
assert.doesNotMatch(runtime, /\bfa fa-/);
|
||||
assert.doesNotMatch(runtime, /FontAwesome|font-awesome\.min\.css|Font Awesome 4|4\.7\.0/);
|
||||
@@ -114,7 +125,7 @@ test('Font Awesome 5 is the only icon contract across every runtime path', () =>
|
||||
assert.doesNotMatch(iconCss, /font:\s*normal\s+normal\s+normal\s+[^;]+Font Awesome 5 Free/);
|
||||
assert.equal(exists('assets/css/font-awesome.min.css'), false);
|
||||
for (const token of iconTokens) {
|
||||
if (utility.test(token) || custom.has(token)) continue;
|
||||
if (utility.test(token) || custom.has(token) || projectFamily.test(token)) continue;
|
||||
assert.ok(fa5.includes(`.${token}:before`), `${token} is not available in Font Awesome 5.15.4`);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user