From 67d178805b371209eda2f5e6b2a9370658e1b25b Mon Sep 17 00:00:00 2001 From: rg755421 Date: Tue, 29 Sep 2026 13:22:15 +0545 Subject: [PATCH 1/2] Fix - Redundant Font Awesome stylesheets loaded alongside all.min.css all.min.css already ships its own complete, byte-identical copy of every rule and @font-face declaration that solid.min.css, regular.min.css and brands.min.css contain, so those three stylesheets were pure duplicate HTTP requests. v4-shims.min.css stays enqueued since it provides the .fa.fa-iconname compound selectors the theme's markup actually uses, which all.min.css does not. Co-Authored-By: Claude Sonnet 5 --- functions.php | 15 ------- .../specs/homepage/front-page-health.spec.ts | 41 +++++++++++++++++++ 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/functions.php b/functions.php index 88d274a..4519885 100644 --- a/functions.php +++ b/functions.php @@ -250,21 +250,6 @@ function flash_scripts() { 'file' => '/all', 'version' => '6.7.2', ), - array( - 'handle' => 'font-awesome-solid', - 'file' => '/solid', - 'version' => '6.7.2', - ), - array( - 'handle' => 'font-awesome-regular', - 'file' => '/regular', - 'version' => '6.7.2', - ), - array( - 'handle' => 'font-awesome-brands', - 'file' => '/brands', - 'version' => '6.7.2', - ), ); foreach ( $font_awesome_styles as $style ) { diff --git a/tests/e2e/specs/homepage/front-page-health.spec.ts b/tests/e2e/specs/homepage/front-page-health.spec.ts index 55b4e20..0e5285b 100644 --- a/tests/e2e/specs/homepage/front-page-health.spec.ts +++ b/tests/e2e/specs/homepage/front-page-health.spec.ts @@ -27,6 +27,47 @@ test("front page serves with no console errors and the preloader clears @fresh @ expect(errors, `unexpected console errors: ${errors.join("; ")}`).toEqual([]); }); +/** + * @area homepage + * @tier fresh + * @source themegrill/flash-pro#21 + * @guards themegrill/flash-pro#21 + * @why functions.php:flash_scripts() used to enqueue css/solid.min.css, + * css/regular.min.css and css/brands.min.css alongside css/all.min.css, + * even though all.min.css already ships its own byte-identical copy of + * every rule (and @font-face) those three files contain - verified by + * diffing every rule block between the files. Guards the actual enqueue + * change (the three redundant requests must be gone, the two real ones + * must remain) and that the header search icon (searchform.php / + * header.php) still resolves a glyph. + */ +test("redundant Font Awesome stylesheets are no longer requested and the header search icon still renders @fresh @homepage", async ({ + page, +}) => { + const faRequests: string[] = []; + page.on("request", (req) => { + const match = req.url().match(/\/css\/(all|solid|regular|brands|v4-shims)\.min\.css/); + if (match) faRequests.push(match[1]); + }); + + await page.goto("/"); + await waitForPreloader(page); + + expect(faRequests, "all.min.css should still be requested").toContain("all"); + expect(faRequests, "v4-shims.min.css should still be requested").toContain("v4-shims"); + expect(faRequests, "solid.min.css is redundant with all.min.css").not.toContain("solid"); + expect(faRequests, "regular.min.css is redundant with all.min.css").not.toContain("regular"); + expect(faRequests, "brands.min.css is redundant with all.min.css").not.toContain("brands"); + + const icon = page.locator(".search-wrap .search-icon .fa-search"); + await expect(icon).toBeVisible(); + const glyph = await icon.evaluate( + (el) => getComputedStyle(el, "::before").content, + ); + expect(glyph, "search icon glyph should still resolve").not.toBe("none"); + expect(glyph.replace(/['"]/g, "").trim().length).toBeGreaterThan(0); +}); + /** * @area homepage * @tier fresh From 82173a1aa115c4f4d94adfebf036645413350fa1 Mon Sep 17 00:00:00 2001 From: rg755421 Date: Tue, 29 Sep 2026 13:36:02 +0545 Subject: [PATCH 2/2] Fix - Copilot review: regression regex missed unminified CSS URLs The matcher required a literal .min.css suffix, so on a SCRIPT_DEBUG install (flash_scripts() drops the .min suffix) the spec would record no Font Awesome requests at all and fail even when the enqueue is correct. Made the .min segment optional so both paths are covered. Co-Authored-By: Claude Sonnet 5 --- tests/e2e/specs/homepage/front-page-health.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/specs/homepage/front-page-health.spec.ts b/tests/e2e/specs/homepage/front-page-health.spec.ts index 0e5285b..400ba07 100644 --- a/tests/e2e/specs/homepage/front-page-health.spec.ts +++ b/tests/e2e/specs/homepage/front-page-health.spec.ts @@ -46,7 +46,7 @@ test("redundant Font Awesome stylesheets are no longer requested and the header }) => { const faRequests: string[] = []; page.on("request", (req) => { - const match = req.url().match(/\/css\/(all|solid|regular|brands|v4-shims)\.min\.css/); + const match = req.url().match(/\/css\/(all|solid|regular|brands|v4-shims)(?:\.min)?\.css/); if (match) faRequests.push(match[1]); });