feat: enhance Related Stories carousels

This commit is contained in:
chrnx committed 2026-08-12 20:44:25 -05:00
1 parent 2fede7cfcc
commit fe142c9c4d
5 files changed
+605

No files matched your search

+18
View File
@@ -168,4 +168,22 @@ class EditorAssetsTest extends WP_UnitTestCase {
);
}
}
/** Related Stories view metadata registers the exact existing local controller only. */
public function test_related_posts_view_script_resolves_to_local_controller() {
do_action( 'init' );
$type = WP_Block_Type_Registry::get_instance()->get_registered( 'chrnx/related-posts' );
$this->assertInstanceOf( WP_Block_Type::class, $type );
$this->assertCount( 1, $type->view_script_handles );
$handle = $type->view_script_handles[0];
$this->assertNotEmpty( $handle );
$scripts = wp_scripts();
$this->assertArrayHasKey( $handle, $scripts->registered );
$registered = $scripts->registered[ $handle ];
$this->assertSame( get_theme_file_uri( 'assets/js/related-posts.js' ), $registered->src );
$this->assertSame( array(), $registered->deps );
$this->assertFileExists( get_theme_file_path( 'assets/js/related-posts.js' ) );
}
}