- Timestamp:
- 05/03/2023 11:29:42 AM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
r55675 r55706 573 573 574 574 /** 575 * Verifies that updates to a document before calls to `get_updated_html()` don't 576 * lead to the Tag Processor jumping to the wrong tag after the updates. 577 * 578 * @ticket 58179 579 * 580 * @covers WP_HTML_Tag_Processor::get_updated_html 581 */ 582 public function test_internal_pointer_returns_to_original_spot_after_inserting_content_before_cursor() { 583 $tags = new WP_HTML_Tag_Processor( '<div>outside</div><section><div><img>inside</div></section>' ); 584 585 $tags->next_tag(); 586 $tags->add_class( 'foo' ); 587 $tags->next_tag( 'section' ); 588 589 // Return to this spot after moving ahead. 590 $tags->set_bookmark( 'here' ); 591 592 // Move ahead. 593 $tags->next_tag( 'img' ); 594 $tags->seek( 'here' ); 595 $this->assertSame( '<div class="foo">outside</div><section><div><img>inside</div></section>', $tags->get_updated_html() ); 596 $this->assertSame( 'SECTION', $tags->get_tag() ); 597 $this->assertFalse( $tags->is_tag_closer() ); 598 } 599 600 /** 575 601 * @ticket 56299 576 602 * … … 1523 1549 1524 1550 $p = new WP_HTML_Tag_Processor( $input ); 1525 $this->assertTrue( $p->next_tag( 'div' ), ' Querying an existing tag did not return true' );1551 $this->assertTrue( $p->next_tag( 'div' ), 'Did not find first DIV tag in input.' ); 1526 1552 $p->set_attribute( 'data-details', '{ "key": "value" }' ); 1527 1553 $p->add_class( 'is-processed' ); … … 1533 1559 ) 1534 1560 ), 1535 ' Querying an existing tag did not return true'1561 'Did not find the first BtnGroup DIV tag' 1536 1562 ); 1537 1563 $p->remove_class( 'BtnGroup' ); … … 1545 1571 ) 1546 1572 ), 1547 ' Querying an existing tag did not return true'1573 'Did not find the second BtnGroup DIV tag' 1548 1574 ); 1549 1575 $p->remove_class( 'BtnGroup' ); … … 1558 1584 ) 1559 1585 ), 1560 ' Querying an existing tag did not return true'1586 'Did not find third BUTTON tag with "btn" CSS class' 1561 1587 ); 1562 1588 $p->remove_attribute( 'class' ); 1563 $this->assertFalse( $p->next_tag( 'non-existent' ), 'Querying a non-existing tag did not return false');1589 $this->assertFalse( $p->next_tag( 'non-existent' ), "Found a {$p->get_tag()} tag when none should have been found." ); 1564 1590 $p->set_attribute( 'class', 'test' ); 1565 1591 $this->assertSame( $expected_output, $p->get_updated_html(), 'Calling get_updated_html after updating the attributes did not return the expected HTML' );
Note: See TracChangeset
for help on using the changeset viewer.