fix(icons): emit FA5 only and upgrade legacy FA4 icon values
The theme is FA5-only, but aksrt_icon_markup() prefixed bare glyphs with the FA4 style token, so stored icon-picker values rendered FA4 markup, and three runtime strings still carried the FA4 double-fa form (report modal header and submit button, comment report menu item). That left the navigation icon contract failing at 11/12. - aksrt_icon_markup() normalizes bare glyphs, legacy FA4 values and style-only values to "fa fas fa-<glyph>", keeping the FA5 brand family (fa fab) and trailing classes intact. - aksrt_normalize_icon_key() strips the legacy FA4 prefix so stored values resolve against the brand-icon catalog again. - report.js and the comment report item emit FA5 markup. - An icon-picker contract test locks the upgrade behaviour. Verification: 338 widget-system, 12 navigation, 28 admin and 13 front-submit contract tests pass; normalization also exercised against legacy, FA5 and brand inputs.
This commit is contained in:
@@ -127,6 +127,18 @@ test('nav menu icons render every format without legacy fa-prefix mangling', ()
|
||||
assert.doesNotMatch(helper, /'<i class="' \. esc_attr\(\$icon_class\)/, 'no raw i-tag bypassing the unified helper');
|
||||
});
|
||||
|
||||
test('icon markup upgrades legacy FA4 values to FA5 and never emits the FA4 form', () => {
|
||||
const helper = read('inc/helpers/aksrt-icons.php');
|
||||
// Bare glyph, legacy double-fa value and style-only value all normalize to FA5 solid.
|
||||
assert.match(helper, /preg_match\('\/\^fa\\s\+fa-\/i', \$value\)/, 'legacy double-fa value is detected');
|
||||
assert.match(helper, /preg_replace\('\/\^fa\\s\+\/i', 'fa fas ', \$value, 1\)/, 'legacy double-fa value upgrades to FA5');
|
||||
assert.match(helper, /\$value = 'fa fas ' \. \$value;/, 'bare glyph gets the FA5 solid prefix');
|
||||
assert.match(helper, /preg_match\('\/\^\(\?:fas\|far\|fab\)\\s\+fa-\/i', \$value\)/, 'style-only value gets the fa token');
|
||||
// Key normalization strips the same legacy form, otherwise stored values miss the
|
||||
// brand-icon catalog and the picker shows an unresolvable key.
|
||||
assert.match(helper, /preg_replace\('\/\^fa\\s\+fa-\/i', '', \(string\) \$name\)/, 'icon keys normalize the legacy FA4 form');
|
||||
});
|
||||
|
||||
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']) {
|
||||
|
||||
Reference in New Issue
Block a user