diff --git a/tests/phpunit/tests/interactivity-api/interactivity-api.php b/tests/phpunit/tests/interactivity-api/wpInteractivityAPIFunctions.php similarity index 92% rename from tests/phpunit/tests/interactivity-api/interactivity-api.php rename to tests/phpunit/tests/interactivity-api/wpInteractivityAPIFunctions.php index 7d74fda8eb44..3a08a2f1af57 100644 --- a/tests/phpunit/tests/interactivity-api/interactivity-api.php +++ b/tests/phpunit/tests/interactivity-api/wpInteractivityAPIFunctions.php @@ -10,7 +10,7 @@ * * @group interactivity-api */ -class Tests_Interactivity_API_Functions extends WP_UnitTestCase { +class Tests_Interactivity_API_wpInteractivityAPIFunctions extends WP_UnitTestCase { /** * Set up. */ @@ -390,4 +390,31 @@ public function test_wp_interactivity_data_wp_context_with_json_flags() { $this->assertEquals( 'data-wp-context=\'{"quot":"\u0022baz\u0022"}\'', wp_interactivity_data_wp_context( array( 'quot' => '"baz"' ) ) ); $this->assertEquals( 'data-wp-context=\'{"amp":"T\u0026T"}\'', wp_interactivity_data_wp_context( array( 'amp' => 'T&T' ) ) ); } + + /** + * Tests that directives processing of tags that don't visit closer tag work. + * + * @ticket 60746 + * + * @covers ::wp_interactivity_process_directives_of_interactive_blocks + */ + public function test_process_directives_in_tags_that_dont_visit_closer_tag() { + register_block_type( + 'test/custom-directive-block', + array( + 'render_callback' => function () { + return ''; + }, + 'supports' => array( + 'interactivity' => true, + ), + ) + ); + $post_content = ''; + $processed_content = do_blocks( $post_content ); + $processor = new WP_HTML_Tag_Processor( $processed_content ); + $processor->next_tag( array( 'class_name' => 'test' ) ); + unregister_block_type( 'test/custom-directive-block' ); + $this->assertEquals( '1', $processor->get_attribute( 'src' ) ); + } }