Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ function accelerate_scripts_styles_method() {

// wp_enqueue_style( 'accelerate-fontawesome', get_template_directory_uri() . '/fontawesome/css/font-awesome.css', array(), '4.7.0' );

wp_enqueue_script( 'html5shiv', ACCELERATE_JS_URL . '/html5shiv.js', array(), '3.7.3', false );
wp_script_add_data( 'html5shiv', 'conditional', 'lte IE 8' );
// Empty handle kept so scripts that list 'html5shiv' as a dependency still load.
wp_register_script( 'html5shiv', false, array(), ACCELERATE_THEME_VERSION, false );
}

function accelerate_block_editor_styles() {
Expand Down
23 changes: 23 additions & 0 deletions tests/e2e/specs/smoke/no-php-notices.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { test, expect } from "@playwright/test";

/**
* @area assets
* @tier fresh
* @guards themegrill/accelerate-pro#21
* @source themegrill/radiate#73 (same fix); themegrill/spacious#151
* @why accelerate_scripts_styles_method() registered html5shiv with
* wp_script_add_data( 'html5shiv', 'conditional', 'lte IE 8' ), which
* WordPress 6.9+ deprecates, so every front-end page printed a
* "Deprecated: WP_Dependencies->add_data()" notice when WP_DEBUG_DISPLAY
* is on. Only observable where debug display is enabled; on a site with it
* off this passes regardless. Asserts no PHP notice markup anywhere in the
* response (it is printed inside <head>), not the absence of html5shiv.
*/
test("front page prints no PHP notices or deprecations @assets @smoke @fresh", async ({ page }) => {
// Read the raw response: PHP prints the notice while wp_head() runs, before
// <body>, so a body locator would miss it.
const response = await page.goto("/");
expect(response?.ok(), `homepage returned HTTP ${response?.status()}`).toBeTruthy();
const html = await response!.text();
expect(html).not.toMatch(/(?:^|>|\s)(?:<b>)?(?:Deprecated|Notice|Warning|Fatal error)(?:<\/b>)?:\s/);
});