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 cb15c0a..817d2f2 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