@@ -747,6 +747,46 @@ public function test_reports_if_block_is_of_type( $html, $block_type ) {
747747 }
748748 }
749749
750+ /**
751+ * Verifies that innerHTML only matches as a block type when checking with the wildcard '*'.
752+ *
753+ * @covers ::is_block_type()
754+ *
755+ * @ticket 64485
756+ */
757+ public function test_inner_html_is_only_a_block_type_match_with_the_wildcard () {
758+ $ processor = new WP_Block_Processor ( '0<!-- wp:b1 -->1<!-- wp:b2 --> ' );
759+
760+ $ processor ->next_token ();
761+ $ this ->assertTrue (
762+ $ processor ->is_block_type ( 'freeform ' ),
763+ 'Failed to detect top-level freeform HTML as freeform block: check test setup. '
764+ );
765+
766+ $ processor ->next_token ();
767+ $ this ->assertTrue (
768+ $ processor ->is_block_type ( 'b1 ' ),
769+ 'Failed to detect opening delimiter as b1 block type: check test setup. '
770+ );
771+
772+ $ processor ->next_token ();
773+ $ this ->assertFalse (
774+ (
775+ $ processor ->is_block_type ( 'freeform ' ) ||
776+ $ processor ->is_block_type ( 'b1 ' ) ||
777+ $ processor ->is_block_type ( 'core/freeform ' ) ||
778+ $ processor ->is_block_type ( 'core/b1 ' ) ||
779+ $ processor ->is_block_type ( '' )
780+ ),
781+ 'Failed to reject innerHTML as a matched block type. '
782+ );
783+
784+ $ this ->assertTrue (
785+ $ processor ->is_block_type ( '* ' ),
786+ 'Failed to accept innerHTML as a wildcard block-type match. '
787+ );
788+ }
789+
750790 /**
751791 * Verifies that the processor indicates if the currently-matched delimiter
752792 * opens a block of a given block type. This is true for openers and void delimiters.
0 commit comments