Skip to content

Commit

Permalink
Verify that get_attribute_names finds attribute added by set_attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Jan 2, 2023
1 parent 2dbf838 commit 5b248c0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions phpunit/html/wp-html-tag-processor-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,29 @@ public function test_get_attribute_names_returns_attribute_names() {
);
}

/**
* @ticket 56299
*
* @covers set_attribute
* @covers get_updated_html
* @covers get_attribute_names
*/
public function test_get_attribute_names_returns_attribute_added_by_set_attribute() {
$p = new WP_HTML_Tag_Processor( '<div class="test">Test</div>' );
$p->next_tag();
$p->set_attribute( 'test-attribute', 'test-value' );
$this->assertSame(
'<div test-attribute="test-value" class="test">Test</div>',
$p->get_updated_html(),
"Updated HTML doesn't include attribute added via set_attribute"
);
$this->assertSame(
array( 'test-attribute', 'class' ),
$p->get_attribute_names(),
"Accessing attribute names doesn't find attribute added via set_attribute"
);
}

/**
* @ticket 56299
*
Expand Down

1 comment on commit 5b248c0

@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/3823412454
📝 Reported issues:

Please sign in to comment.