diff --git a/tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.php b/tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.php index 1ce8855305ae9..a4502c531c6ef 100644 --- a/tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.php +++ b/tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.php @@ -853,4 +853,39 @@ public static function data_provider_normalize_special_leading_newline_cases(): ), ); } + + /** + * Ensures that serialize_token() reflects enqueued attribute updates instead + * of emitting removed attributes as value-less attributes or omitting added ones. + * + * serialize_token() iterates the names from get_attribute_names_with_prefix( '' ) + * but reads each value through get_attribute(). Before #64567 the name list did not + * reflect enqueued updates while the values did, so a removed attribute survived in + * the output as a boolean attribute and an added attribute was dropped entirely. + * + * @ticket 64567 + * + * @covers WP_HTML_Processor::serialize_token + */ + public function test_serialize_token_reflects_enqueued_attribute_updates() { + $processor = WP_HTML_Processor::create_fragment( '