- Timestamp:
- 10/16/2023 02:00:01 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php
r56790 r56941 412 412 413 413 /** 414 * Ensures that updating tag's attributes doesn't shift the current position 415 * in the input HTML document. 416 * 417 * @since 6.4.0 418 * 419 * @ticket 59607 420 * 421 * @covers WP_HTML_Tag_Processor::get_updated_html 422 */ 423 public function test_remains_stable_when_editing_attributes() { 424 $p = WP_HTML_Processor::create_fragment( '<div><button>First<button><b here>Second' ); 425 $p->next_tag( array( 'breadcrumbs' => array( 'BUTTON', 'B' ) ) ); 426 427 $this->assertSame( 428 array( 'HTML', 'BODY', 'DIV', 'BUTTON', 'B' ), 429 $p->get_breadcrumbs(), 430 'Found the wrong nested structure at the matched tag.' 431 ); 432 433 $p->set_attribute( 'a-name', 'a-value' ); 434 435 $this->assertTrue( 436 $p->get_attribute( 'here' ), 437 'Should have found the B tag but could not find expected "here" attribute.' 438 ); 439 440 $this->assertSame( 441 array( 'HTML', 'BODY', 'DIV', 'BUTTON', 'B' ), 442 $p->get_breadcrumbs(), 443 'Found the wrong nested structure at the matched tag.' 444 ); 445 446 $p->get_updated_html(); 447 448 $this->assertTrue( 449 $p->get_attribute( 'here' ), 450 'Should have stayed at the B tag but could not find expected "here" attribute.' 451 ); 452 453 $this->assertSame( 454 array( 'HTML', 'BODY', 'DIV', 'BUTTON', 'B' ), 455 $p->get_breadcrumbs(), 456 'Found the wrong nested structure at the matched tag after updating attributes.' 457 ); 458 } 459 460 /** 414 461 * Ensures that the ability to set attributes isn't broken by the HTML Processor. 415 462 * … … 418 465 * @ticket 58517 419 466 * 420 * @covers WP_HTML_ Processor::set_attribute467 * @covers WP_HTML_Tag_Processor::set_attribute 421 468 */ 422 469 public function test_can_modify_attributes_after_finding_tag() {
Note: See TracChangeset
for help on using the changeset viewer.