fix: expose meaningful music collage alt

This commit is contained in:
chrnx committed 2026-08-12 17:26:08 -05:00
1 parent 59e4f36846
commit 5518e3598a
2 files changed
+23 -7

No files matched your search

+21 -6
View File
@@ -215,12 +215,10 @@ class PatternsTest extends WP_UnitTestCase {
'atmosphere' => 'chrnx-character-stage__collage',
),
'music-landing' => array(
'heading' => 'The No Names',
'order' => array( 'The No Names', 'Grunge mexicano para cerebros que no se callan.', 'The No Names es una banda activa', 'El proceso usa generative AI' ),
'art' => 'the-no-names-musician-cutout.png',
'art_alt' => 'The No Names musician portrait',
'atmosphere' => 'chrnx-character-stage__collage',
'atmos_alt' => 'The No Names collage',
'heading' => 'The No Names',
'order' => array( 'The No Names', 'Grunge mexicano para cerebros que no se callan.', 'The No Names es una banda activa', 'El proceso usa generative AI' ),
'art' => 'the-no-names-musician-cutout.png',
'art_alt' => 'The No Names musician portrait',
),
'podcast-landing' => array(
'heading' => 'Podcasts',
@@ -311,6 +309,23 @@ class PatternsTest extends WP_UnitTestCase {
}
}
/** Meaningful Music collage text remains exposed to assistive technology. */
public function test_music_landing_meaningful_collage_is_not_hidden_by_the_atmosphere_layer() {
$content = $this->render_pattern( get_theme_file_path( 'patterns/music-landing.php' ) );
$dom = $this->load_html_fragment( $content );
$xpath = new DOMXPath( $dom );
$stage = $xpath->query( '//*[contains(concat(" ", normalize-space(@class), " "), " chrnx-character-stage ")]' )->item( 0 );
$collage = $xpath->query( '//img[@alt="The No Names collage"]' )->item( 0 );
$this->assertInstanceOf( DOMElement::class, $stage );
$this->assertInstanceOf( DOMElement::class, $collage );
$this->assertCount( 3, $xpath->query( './*', $stage ) );
$this->assertCount( 0, $xpath->query( 'ancestor::*[@aria-hidden="true"]', $collage ) );
$this->assertCount( 1, $xpath->query( 'ancestor::*[contains(concat(" ", normalize-space(@class), " "), " chrnx-character-stage__content ")]', $collage ) );
$this->assertCount( 0, $xpath->query( './*[contains(concat(" ", normalize-space(@class), " "), " chrnx-character-stage__atmosphere ")]//picture', $stage ) );
$this->assertCount( 1, $xpath->query( './*[contains(concat(" ", normalize-space(@class), " "), " chrnx-character-stage__art ")]//picture', $stage ) );
}
/** Rendered pattern content survives parse/serialize without block-tree drift. */
public function test_character_led_patterns_preserve_editor_fidelity() {
foreach ( array( 'home-projects', 'home-music', 'music-landing', 'podcast-landing', 'about' ) as $name ) {