Skip to content

Commit

Permalink
Add failing test for reading attribute update before flushing updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell authored and ockham committed Jan 4, 2023
1 parent 9ccc918 commit ec21489
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions phpunit/html/wp-html-tag-processor-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,21 @@ public function test_set_attribute_with_a_non_existing_attribute_adds_a_new_attr
$this->assertSame( 'test-value', $p->get_attribute( 'test-attribute' ) );
}

/**
* @ticket 56299
*
* @covers set_attribute
* @covers get_updated_html
* @covers get_attribute
*/
public function test_get_attribute_returns_updated_values_before_they_are_updated() {
$p = new WP_HTML_Tag_Processor( self::HTML_SIMPLE );
$p->next_tag();
$p->set_attribute( 'test-attribute', 'test-value' );
$this->assertSame( 'test-value', $p->get_attribute( 'test-attribute' ) );
$this->assertSame( '<div test-attribute="test-value" id="first"><span id="second">Text</span></div>', $p->get_updated_html() );
}

/**
* According to HTML spec, only the first instance of an attribute counts.
* The other ones are ignored.
Expand Down

1 comment on commit ec21489

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3837187375
📝 Reported issues:

Please sign in to comment.