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 Jun 28, 2024
1 parent 5effffc commit a09516d
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 a09516d

Please sign in to comment.