feat: give each project its own page header and post stream
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
5 files changed
+114
-7
No files matched your search
@@ -73,4 +73,59 @@ class ProjectBlocksTest extends WP_UnitTestCase {
|
||||
|
||||
$this->assertStringContainsString( 'chrnx-project-card__fallback', $markup );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the detail block renders the queried project header.
|
||||
*/
|
||||
public function test_project_detail_renders_the_queried_term() {
|
||||
$term_id = self::factory()->term->create(
|
||||
array(
|
||||
'taxonomy' => 'chrnx_project',
|
||||
'name' => 'Ailed',
|
||||
'slug' => 'ailed-test',
|
||||
'description' => 'A chess engine that feels.',
|
||||
)
|
||||
);
|
||||
update_term_meta( $term_id, 'chrnx_project_repo', 'https://github.com/example/ailed' );
|
||||
update_term_meta( $term_id, 'chrnx_project_status', 'Activo' );
|
||||
|
||||
$this->go_to( get_term_link( $term_id ) );
|
||||
|
||||
$markup = do_blocks( '<!-- wp:chrnx/project-detail /-->' );
|
||||
|
||||
$this->assertStringContainsString( 'A chess engine that feels.', $markup );
|
||||
$this->assertStringContainsString( 'https://github.com/example/ailed', $markup );
|
||||
$this->assertStringContainsString( 'Activo', $markup );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the detail block renders nothing outside a project archive.
|
||||
*/
|
||||
public function test_project_detail_is_silent_off_its_archive() {
|
||||
$this->go_to( home_url( '/' ) );
|
||||
|
||||
$this->assertSame( '', trim( do_blocks( '<!-- wp:chrnx/project-detail /-->' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure a project archive filters the journal to that project.
|
||||
*/
|
||||
public function test_project_archive_filters_the_journal() {
|
||||
$term_id = self::factory()->term->create(
|
||||
array(
|
||||
'taxonomy' => 'chrnx_project',
|
||||
'slug' => 'filter-test',
|
||||
)
|
||||
);
|
||||
$mine = self::factory()->post->create( array( 'post_title' => 'Belongs to the project' ) );
|
||||
self::factory()->post->create( array( 'post_title' => 'Unrelated post' ) );
|
||||
wp_set_object_terms( $mine, array( $term_id ), 'chrnx_project' );
|
||||
|
||||
$this->go_to( get_term_link( $term_id ) );
|
||||
|
||||
$markup = do_blocks( '<!-- wp:chrnx/journal-stream /-->' );
|
||||
|
||||
$this->assertStringContainsString( 'Belongs to the project', $markup );
|
||||
$this->assertStringNotContainsString( 'Unrelated post', $markup );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user