diff --git a/blocks/footer-content/render.php b/blocks/footer-content/render.php index 417b43b..8045995 100644 --- a/blocks/footer-content/render.php +++ b/blocks/footer-content/render.php @@ -5,28 +5,7 @@ * @package CHRNX */ -$chrnx_footer_links = array( - array( - 'label' => __( 'Journal', 'chrnx' ), - 'url' => home_url( '/journal/' ), - ), - array( - 'label' => __( 'Projects', 'chrnx' ), - 'url' => home_url( '/projects/' ), - ), - array( - 'label' => __( 'Music', 'chrnx' ), - 'url' => home_url( '/music/' ), - ), - array( - 'label' => __( 'Podcasts', 'chrnx' ), - 'url' => home_url( '/podcasts/' ), - ), - array( - 'label' => __( 'About', 'chrnx' ), - 'url' => home_url( '/about/' ), - ), -); +$chrnx_footer_links = chrnx_get_navigation_links( 'chrnx-footer' ); $chrnx_site_name = get_bloginfo( 'name' ); $chrnx_current_url = chrnx_get_current_navigation_destination(); $chrnx_copyright = sprintf( diff --git a/tests/smoke/theme-preference-contract.test.mjs b/tests/smoke/theme-preference-contract.test.mjs index 83b8d1b..c39205f 100644 --- a/tests/smoke/theme-preference-contract.test.mjs +++ b/tests/smoke/theme-preference-contract.test.mjs @@ -56,9 +56,14 @@ test('footer user-facing copy lives in an extractable PHP render block', async ( const render = await readProjectFile('blocks/footer-content/render.php'); assert.match(part, //); assert.doesNotMatch(part, /Made in Sinaloa|Journal|Footer navigation/); - for (const text of ['Footer navigation', 'Journal', 'Projects', 'Music', 'Podcasts', 'About', 'Made in Sinaloa, shared from home.']) { + const navHelper = await readProjectFile('inc/blocks.php'); + for (const text of ['Footer navigation', 'Made in Sinaloa, shared from home.']) { assert.ok(render.includes(`'${text}', 'chrnx'`), `${text} must use the chrnx text domain`); } + // The link labels moved to the shared navigation helper, still translatable. + for (const text of ['Journal', 'Projects', 'Music', 'Podcasts', 'About']) { + assert.ok(navHelper.includes(`'${text}', 'chrnx'`), `${text} must use the chrnx text domain`); + } }); test('header navigation and search copy lives in one extractable PHP render block', async () => { @@ -66,9 +71,15 @@ test('header navigation and search copy lives in one extractable PHP render bloc const render = await readProjectFile('blocks/header-tools/render.php'); assert.match(part, //); assert.doesNotMatch(part, /wp:navigation|wp:navigation-link|wp:search|Journal|Primary navigation/); - for (const text of ['Primary navigation', 'Journal', 'Projects', 'Music', 'Podcasts', 'About', 'Search', 'Open search']) { + const navHelper = await readProjectFile('inc/blocks.php'); + for (const text of ['Primary navigation', 'Search', 'Open search']) { assert.ok(render.includes(`'${text}', 'chrnx'`), `${text} must use the chrnx text domain`); } - assert.match(render, /home_url\( '\/journal\/' \)/); + for (const text of ['Journal', 'Projects', 'Music', 'Podcasts', 'About']) { + assert.ok(navHelper.includes(`'${text}', 'chrnx'`), `${text} must use the chrnx text domain`); + } + // The built-in destinations remain the fallback when no menu is assigned. + assert.match(navHelper, /home_url\( '\/' \. \$slug \. '\/' \)/); + assert.match(navHelper, /get_nav_menu_locations\(\)/); assert.match(render, /home_url\( '\/' \)/); });