refactor: compose CHRNX music and podcast stages
This commit is contained in:
8 files changed
+543
-19
No files matched your search
@@ -462,6 +462,51 @@ test( 'character-led openings share the exact stage class contract', () => {
|
||||
assert.match( read( 'blocks/topic-hero/render.php' ), /chrnx-topic-hero__fallback/ );
|
||||
} );
|
||||
|
||||
test( 'Music and Podcast patterns own one ordered three-layer landing composition', () => {
|
||||
const music = read( 'patterns/music-landing.php' );
|
||||
const podcast = read( 'patterns/podcast-landing.php' );
|
||||
const pages = JSON.parse( read( 'tests/fixtures/pages.json' ) );
|
||||
const assertLayerOrder = ( source, label ) => {
|
||||
const stage = source.indexOf( 'className":"chrnx-character-stage"' );
|
||||
const atmosphere = source.indexOf( 'chrnx-character-stage__atmosphere', stage );
|
||||
const content = source.indexOf( 'chrnx-character-stage__content', atmosphere );
|
||||
const art = source.indexOf( 'chrnx-character-stage__art', content );
|
||||
assert.ok( stage >= 0 && atmosphere > stage && content > atmosphere && art > content, label );
|
||||
};
|
||||
|
||||
assertLayerOrder( music, 'Music layer order' );
|
||||
assert.equal( ( music.match( /chrnx_get_topic_portrait_markup\( 'music-collage'/g ) || [] ).length, 1 );
|
||||
assert.equal( ( music.match( /chrnx_get_topic_portrait_markup\( 'music',/g ) || [] ).length, 1 );
|
||||
assert.doesNotMatch(
|
||||
music.match( /chrnx-character-stage__atmosphere[\s\S]*?chrnx-character-stage__content/ )?.[ 0 ] ?? '',
|
||||
/aria-hidden="true"/,
|
||||
);
|
||||
assert.ok(
|
||||
music.indexOf( 'chrnx_get_topic_portrait_markup( \'music-collage\'' ) <
|
||||
music.indexOf( 'chrnx-character-stage__content' ),
|
||||
);
|
||||
assert.ok(
|
||||
music.indexOf( 'El proceso usa generative AI' ) > music.indexOf( '<!-- /wp:group -->', music.indexOf( 'chrnx-character-stage__art' ) ) &&
|
||||
music.indexOf( 'El proceso usa generative AI' ) < music.indexOf( 'Releases in progress' ),
|
||||
);
|
||||
|
||||
assertLayerOrder( podcast, 'Podcast layer order' );
|
||||
assert.equal( ( podcast.match( /chrnx_get_atmosphere_markup\( 'podcast-frequency'/g ) || [] ).length, 1 );
|
||||
assert.equal( ( podcast.match( /chrnx_get_topic_portrait_markup\( 'podcasts'/g ) || [] ).length, 1 );
|
||||
assert.equal( ( podcast.match( /<!-- wp:chrnx\/latest-podcast \/-->/g ) || [] ).length, 1 );
|
||||
assert.match( podcast, /chrnx-character-stage__atmosphere" aria-hidden="true"/ );
|
||||
assert.match( podcast, /chrnx\/podcast-show-discovery/ );
|
||||
assert.match( podcast, /chrnx\/podcast-archive/ );
|
||||
assert.doesNotMatch( podcast, /chrnx\/podcast-latest/ );
|
||||
|
||||
assert.equal( pages.length, 7 );
|
||||
const podcastPage = pages.find( ( page ) => page.slug === 'podcasts' );
|
||||
assert.equal(
|
||||
podcastPage?.content,
|
||||
'<!-- wp:pattern {"slug":"chrnx/podcast-landing"} /-->',
|
||||
);
|
||||
} );
|
||||
|
||||
test( 'character stages define the shared mockup effect and responsive geometry', () => {
|
||||
const components = read( 'assets/css/components.css' );
|
||||
const visualStates = read( 'tests/e2e/visual-states.spec.mjs' );
|
||||
|
||||
Reference in new issue
Block a user