fix: align CHRNX title eligibility

This commit is contained in:
chrnx committed 2026-08-11 16:06:47 -05:00
1 parent dab82cfa06
commit a769228c01
3 files changed
+66 -29

No files matched your search

+20
View File
@@ -172,6 +172,26 @@ class BlockRenderingTest extends WP_UnitTestCase {
$this->assertStringNotContainsString( 'placeholder', strtolower( $output ) );
}
/** Stored title markup is displayed literally and cannot inject executable elements. */
public function test_editorial_cards_escape_stored_title_markup() {
$title = '<b title="> x" onmouseover="alert(1)"><script>alert(2)</script></b>';
$post_id = self::factory()->post->create( array( 'post_title' => $title ) );
$output = render_block(
array(
'blockName' => 'chrnx/featured-stories',
'attrs' => array( 'limit' => 1 ),
'innerBlocks' => array(),
'innerHTML' => '',
'innerContent' => array(),
)
);
$this->assertSame( $post_id, chrnx_get_featured_story_ids( 1 )[0] );
$this->assertStringContainsString( esc_html( get_the_title( $post_id ) ), $output );
$this->assertStringNotContainsString( '<script', $output );
$this->assertStringNotContainsString( '<b title=', $output );
}
/** Every CSS fallback is visible, deterministic, decorative, and registered with its block. */
public function test_editorial_fallbacks_have_registered_visible_static_styles() {
$contracts = array(