Skip to content

Commit

Permalink
Add tests for leading/trailing whitespace in modified class attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Jul 15, 2024
1 parent 5e6e9a4 commit 7d48ce7
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2875,4 +2875,35 @@ public function insert_after( $new_html ) {
'Should have properly applied the update from in front of the cursor.'
);
}

/**
* @ticket TBD
*
* @covers ::remove_class
*/
public function test_remove_class_removes_leading_white_space() {
$processor = new WP_HTML_Tag_Processor( '<div class="remove keep">' );
$processor->next_tag();
$processor->remove_class( 'remove' );
$this->assertSame(
'<div class="keep">',
$processor->get_updated_html(),
'::remove_class did not correctly clean whitespace from removed class.'
);
}
/**
* @ticket TBD
*
* @covers ::remove_class
*/
public function test_remove_class_maintains_trailing_white_space() {
$processor = new WP_HTML_Tag_Processor( '<div class="keep remove">' );
$processor->next_tag();
$processor->remove_class( 'remove' );
$this->assertSame(
'<div class="keep">',
$processor->get_updated_html(),
'::remove_class did not correctly clean whitespace from removed class.'
);
}
}

0 comments on commit 7d48ce7

Please sign in to comment.