feat: add CHRNX shell and theme preference

This commit is contained in:
chrnx committed 2026-08-11 16:54:17 -05:00
1 parent aad237b211
commit f371db4cb5
18 files changed
+633 -16

No files matched your search

+20 -2
View File
@@ -15,9 +15,9 @@ class BlockRenderingTest extends WP_UnitTestCase {
delete_option( 'chrnx_subscribe_page_id' );
}
/** All eight block types register from metadata. */
/** All nine block types register from metadata. */
public function test_all_editorial_blocks_are_registered() {
$names = array( 'featured-stories', 'journal-stream', 'latest-podcast', 'podcast-meta', 'topic-hero', 'related-posts', 'subscribe-cta', 'theme-toggle' );
$names = array( 'featured-stories', 'journal-stream', 'latest-podcast', 'podcast-meta', 'topic-hero', 'related-posts', 'subscribe-cta', 'theme-toggle', 'site-brand' );
foreach ( $names as $name ) {
$type = WP_Block_Type_Registry::get_instance()->get_registered( 'chrnx/' . $name );
$this->assertInstanceOf( WP_Block_Type::class, $type, $name );
@@ -25,6 +25,24 @@ class BlockRenderingTest extends WP_UnitTestCase {
}
}
/** The approved local wordmark links to the portable site home URL. */
public function test_site_brand_renders_escaped_local_home_and_wordmark_urls() {
$output = render_block(
array(
'blockName' => 'chrnx/site-brand',
'attrs' => array(),
'innerBlocks' => array(),
'innerHTML' => '',
'innerContent' => array(),
)
);
$this->assertStringContainsString( 'href="' . esc_url( home_url( '/' ) ) . '"', $output );
$this->assertStringContainsString( 'src="' . esc_url( get_theme_file_uri( 'assets/icons/chrnx-wordmark.svg' ) ) . '"', $output );
$this->assertStringContainsString( 'alt="CHRNX"', $output );
$this->assertStringContainsString( 'href="#chrnx-main"', $output );
}
/** Topic art is an exact fixed mapping and rejects arbitrary paths. */
public function test_topic_art_uses_only_the_fixed_mapping() {
$expected = array(