fix(navigation): stop mangling zibsvg/customsvg menu icons

aksrt_render_menu_icon() prefixed any value without an fa substring
with fa fas fa-, turning picker values like zibsvg-hot into
fa fas fa-zibsvg-hot — blank icons in the frontend nav. Sprite and
inline SVG values now flow through aksrt_icon_markup with the
menu-item-icon classes attached; FA values keep the legacy padding.
This commit is contained in:
2026-09-06 14:27:49 +08:00
parent 70cba11fb7
commit 2e25894eb5
2 changed files with 40 additions and 2 deletions
@@ -90,6 +90,34 @@ test('FA5 loads under a single canonical handle everywhere', () => {
}
});
test('custom settings pages and standalone save paths speak the three icon formats', () => {
// 手机底部Tab / 右侧悬浮按钮 custom pages render the shared picker.
for (const page of ['assets/admin/src/pages/content/FooterTabbarSettings.vue', 'assets/admin/src/pages/content/FloatingButtonsSettings.vue']) {
const source = read(page);
assert.match(source, /import FaIconPicker from '@\/components\/form\/FaIconPicker\.vue'/);
assert.match(source, /import IconValue from '@\/components\/form\/IconValue\.vue'/);
assert.match(source, /<FaIconPicker/, `${page} uses the picker for icon fields`);
}
// Their REST save paths keep customsvg markup intact.
const controller = read('src/Admin/GlobalControllerPart1.php');
assert.match(controller, /aksrt_sanitize_icon_value\(/);
assert.doesNotMatch(controller, /preg_match\('\/\^fa\\s\+/, 'no FA-only regex gate on icon fields');
// Frontend consumers render every format.
const footer = read('footer.php');
assert.match(footer, /aksrt_icon_markup\(\(string\) \$tab_icon\)/);
assert.match(footer, /aksrt_icon_markup\(\(string\) \$item_icon\)/);
assert.match(read('inc/helpers/aksrt-runtime-win.php'), /aksrt_icon_markup\(\$icon\)/);
// The popover tabs must wrap instead of overflowing the panel.
assert.match(read('assets/admin/src/components/form/FaIconPicker.vue'), /flex-wrap: wrap/);
});
test('nav menu icons render every format without legacy fa-prefix mangling', () => {
const helper = read('inc/helpers/menu-decoration.php');
assert.match(helper, /str_starts_with\(\$icon_class, 'zibsvg-'\)/);
assert.match(helper, /aksrt_icon_markup\(\$icon_class, 'icon mr3 menu-item-icon'\)/);
assert.doesNotMatch(helper, /'<i class="' \. esc_attr\(\$icon_class\)/, 'no raw i-tag bypassing the unified helper');
});
test('brand icons render despite the zibll-legacy fa-fab double prefix', () => {
const rule = /\.fa\.fab\{font-family:"Font Awesome 5 Brands";font-weight:400\}/;
for (const file of ['assets/css/main.css', 'assets/css/admin-icon-picker.css', 'assets/admin/src/style.css']) {