fix: optimize CHRNX editorial media

This commit is contained in:
chrnx committed 2026-08-12 15:52:53 -05:00
1 parent 55e21bca81
commit c5720b21ca
14 files changed
+252 -46

No files matched your search

+18
View File
@@ -78,6 +78,24 @@ class PatternsTest extends WP_UnitTestCase {
$this->assertStringContainsString( 'aria-hidden="true"', $show );
}
/** Home music layers a lazy responsive collage and musician in one frame. */
public function test_home_music_uses_responsive_decorative_collage_layer() {
$source = file_get_contents( get_theme_file_path( 'patterns/home-music.php' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local test fixture.
$content = $this->render_pattern( get_theme_file_path( 'patterns/home-music.php' ) );
$this->assertStringContainsString( "chrnx_get_topic_portrait_markup( 'music-collage'", $source );
$this->assertStringContainsString( 'chrnx-home-music__collage-layer', $content );
$this->assertStringContainsString( 'the-no-names-collage-384.avif 384w', $content );
$this->assertStringContainsString( 'the-no-names-collage-768.webp 768w', $content );
$this->assertStringContainsString( 'sizes="(max-width: 599px) 100vw, 720px"', $content );
$this->assertMatchesRegularExpression( '/class="chrnx-home-music__collage"[^>]*loading="lazy"[^>]*alt=""/', $content );
$this->assertStringContainsString( 'the-no-names-musician-cutout.png', $content );
$this->assertLessThan(
strpos( $content, 'the-no-names-musician-cutout.png' ),
strpos( $content, 'the-no-names-collage-384.avif' )
);
}
/** Music copy contains only the exact approved public facts and release statuses. */
public function test_music_patterns_use_approved_honest_copy() {
$content = $this->render_pattern( get_theme_file_path( 'patterns/music-landing.php' ) );