- Timestamp:
- 05/29/2024 11:55:27 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPIFunctions.php
r57987 r58234 526 526 $this->assertNull( $input_value ); 527 527 } 528 529 /** 530 * Tests interactivity_process_directives filter. 531 * 532 * @ticket 61185 533 * 534 * @covers wp_interactivity_process_directives 535 */ 536 public function test_not_processing_directives_filter() { 537 wp_interactivity_state( 538 'dont-process', 539 array( 540 'text' => 'text', 541 ) 542 ); 543 register_block_type( 544 'test/custom-directive-block', 545 array( 546 'render_callback' => function () { 547 return '<div data-wp-interactive="dont-process"><input data-wp-bind--value="state.text" /></div>'; 548 }, 549 'supports' => array( 550 'interactivity' => true, 551 ), 552 ) 553 ); 554 $post_content = '<!-- wp:test/custom-directive-block /-->'; 555 add_filter( 'interactivity_process_directives', '__return_false' ); 556 $processed_content = do_blocks( $post_content ); 557 $processor = new WP_HTML_Tag_Processor( $processed_content ); 558 $processor->next_tag( array( 'tag_name' => 'input' ) ); 559 $input_value = $processor->get_attribute( 'value' ); 560 remove_filter( 'interactivity_process_directives', '__return_false' ); 561 unregister_block_type( 'test/custom-directive-block' ); 562 $this->assertNull( $input_value ); 563 } 528 564 }
Note: See TracChangeset
for help on using the changeset viewer.