- Timestamp:
- 10/21/2025 12:07:16 PM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-context.php
r58594 r61020 523 523 $this->assertSame( 'some-id-1', $p->get_attribute( 'id' ) ); 524 524 } 525 526 /** 527 * Tests supports multiple context directives in the same element. 528 * 529 * @ticket 64106 530 * 531 * @covers ::process_directives 532 */ 533 public function test_wp_context_supports_multiple_directives_in_the_same_element() { 534 $html = ' 535 <div 536 data-wp-interactive="directive-context/multiple" 537 data-wp-context=\'{ "prop": "parent", "parent": true }\' 538 > 539 <div 540 data-wp-context---id2=\'other-namespace::{ "prop": true }\' 541 data-wp-context=\'{ "prop": "default", "default": true }\' 542 data-wp-context---id1=\'{ "prop": "id1", "id1": true }\' 543 > 544 <span 545 class="test" 546 data-wp-bind--data-test-prop="context.prop" 547 data-wp-bind--data-test-parent="context.parent" 548 data-wp-bind--data-test-default="context.default" 549 data-wp-bind--data-test-id1="context.id1" 550 data-wp-bind--data-test-other="other-namespace::context.prop" 551 ></span> 552 </div> 553 </div> 554 '; 555 list($p) = $this->process_directives( $html ); 556 $this->assertSame( 'id1', $p->get_attribute( 'data-test-prop' ) ); 557 foreach ( array( 'parent', 'default', 'id1', 'other' ) as $attribute ) { 558 $attr_name = "data-test-$attribute"; 559 $this->assertSame( 560 'true', 561 $p->get_attribute( $attr_name ), 562 "Failed asserting that $attr_name equals 'true'" 563 ); 564 } 565 } 525 566 }
Note: See TracChangeset
for help on using the changeset viewer.