fix: address CHRNX editorial review findings
This commit is contained in:
17 files changed
+236
-10
No files matched your search
@@ -58,7 +58,7 @@ class PatternsTest extends WP_UnitTestCase {
|
||||
|
||||
/** Local art is generated through escaped theme URIs with intrinsic dimensions. */
|
||||
public function test_art_patterns_use_only_escaped_local_theme_images() {
|
||||
foreach ( array( 'home-music', 'music-landing', 'podcast-landing' ) as $name ) {
|
||||
foreach ( array( 'home-music', 'music-landing', 'podcast-landing', 'podcast-show' ) as $name ) {
|
||||
$source = file_get_contents( get_theme_file_path( 'patterns/' . $name . '.php' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local test fixture.
|
||||
$content = $this->render_pattern( get_theme_file_path( 'patterns/' . $name . '.php' ) );
|
||||
$this->assertStringContainsString( 'get_theme_file_uri(', $source, $name );
|
||||
@@ -66,6 +66,15 @@ class PatternsTest extends WP_UnitTestCase {
|
||||
$this->assertMatchesRegularExpression( '/<img\b[^>]*\bwidth="1122"[^>]*\bheight="1402"/i', $content, $name );
|
||||
$this->assertMatchesRegularExpression( '/<img\b[^>]*\bloading="lazy"[^>]*\bdecoding="async"/i', $content, $name );
|
||||
}
|
||||
$music = $this->render_pattern( get_theme_file_path( 'patterns/music-landing.php' ) );
|
||||
$this->assertStringContainsString( 'the-no-names-collage.jpeg', $music );
|
||||
$this->assertStringContainsString( 'the-no-names-musician-cutout.png', $music );
|
||||
$this->assertSame( 2, substr_count( $music, '<img' ) );
|
||||
|
||||
$show = $this->render_pattern( get_theme_file_path( 'patterns/podcast-show.php' ) );
|
||||
$this->assertStringContainsString( 'alter-ego-podcasts.png', $show );
|
||||
$this->assertStringContainsString( 'alt=""', $show );
|
||||
$this->assertStringContainsString( 'aria-hidden="true"', $show );
|
||||
}
|
||||
|
||||
/** Music copy contains only the exact approved public facts and release statuses. */
|
||||
@@ -102,6 +111,10 @@ class PatternsTest extends WP_UnitTestCase {
|
||||
$this->assertStringContainsString( 'target="_blank"', $content );
|
||||
$this->assertStringContainsString( 'rel="noopener noreferrer external"', $content );
|
||||
$this->assertDoesNotMatchRegularExpression( '/diagnos|inspir|overcame|despite/i', $content );
|
||||
$plain = wp_strip_all_tags( $content );
|
||||
$this->assertLessThan( strpos( $plain, 'autistic Level 1' ), strpos( $plain, 'Lead Developer @Expressive Tea' ) );
|
||||
$this->assertLessThan( strpos( $plain, 'autistic Level 1' ), strpos( $plain, 'emotion modeling and game AI' ) );
|
||||
$this->assertLessThan( strpos( $plain, 'father of three wonderful children' ), strpos( $plain, 'autistic Level 1' ) );
|
||||
}
|
||||
|
||||
/** Reusable project/release/show/episode structures do not invent visible starter data. */
|
||||
|
||||
Reference in new issue
Block a user