Files
chrnx-dev-wp/tests/php/ThemeSetupTest.php
T
chrnxandClaude Opus 5 a3ba692669 fix: correct entry layout, light mode and editor parity
The single/page/404 templates set contentSize to 70ch, which resolves
against each child's own font size: the display-size h1 asked for
~2660px and broke full bleed while the body stayed narrow. They now
inherit the 720px from theme.json.

Also drops the About facets that duplicated the portrait, adds the
missing prefers-color-scheme branch for the character stage copy
surface (dark text on a dark panel in System light), loads
components.css in the editor, and replaces the unstyled index
fallback with the journal stream.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:41:09 -05:00

70 lines
2.1 KiB
PHP

<?php
/**
* Tests for theme setup.
*
* @package CHRNX
*/
/**
* Verify the theme's WordPress setup contract.
*/
class ThemeSetupTest extends WP_UnitTestCase {
/**
* Ensure the required theme supports are registered.
*/
public function test_required_theme_supports_are_registered() {
$this->assertTrue( current_theme_supports( 'title-tag' ) );
$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
$this->assertTrue( current_theme_supports( 'responsive-embeds' ) );
$this->assertTrue( current_theme_supports( 'editor-styles' ) );
}
/**
* Ensure the card crop is available to future card components.
*/
public function test_card_image_size_is_registered() {
$this->assertTrue( has_image_size( 'chrnx-card' ) );
}
/**
* Ensure the base stylesheet is available in the editor.
*/
public function test_base_editor_stylesheet_is_registered() {
global $editor_styles;
$this->assertContains( 'assets/css/base.css', $editor_styles );
$this->assertContains( 'assets/css/layout.css', $editor_styles );
$this->assertContains( 'assets/css/components.css', $editor_styles );
}
/**
* Ensure the local base stylesheet is enqueued with the theme version.
*/
public function test_base_stylesheet_is_enqueued_locally_with_theme_version() {
wp_dequeue_style( 'chrnx-base' );
wp_deregister_style( 'chrnx-base' );
try {
do_action( 'wp_enqueue_scripts' );
$styles = wp_styles();
$this->assertTrue( wp_style_is( 'chrnx-base', 'enqueued' ) );
$this->assertArrayHasKey( 'chrnx-base', $styles->registered );
$base = $styles->registered['chrnx-base'];
$this->assertSame( get_theme_file_uri( 'assets/css/base.css' ), $base->src );
$this->assertSame( CHRNX_VERSION, $base->ver );
$this->assertTrue( wp_style_is( 'chrnx-layout', 'enqueued' ) );
$this->assertSame( array( 'chrnx-base' ), $styles->registered['chrnx-layout']->deps );
$this->assertSame( get_theme_file_uri( 'assets/css/layout.css' ), $styles->registered['chrnx-layout']->src );
} finally {
wp_dequeue_style( 'chrnx-base' );
wp_deregister_style( 'chrnx-base' );
wp_dequeue_style( 'chrnx-layout' );
wp_deregister_style( 'chrnx-layout' );
}
}
}