Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell committed Dec 16, 2023
1 parent 4e0c799 commit e83ff85
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,26 +557,32 @@ public function test_next_tag_should_stop_on_rcdata_and_script_tag_closers_when_
$p = new WP_HTML_Tag_Processor( '<script>abc</script>' );

$p->next_tag();
$this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </script> tag closer' );
$this->assertTrue( $p->is_tag_closer(), 'Indicated a <script> tag opener is a tag closer' );
$this->assertFalse(
$p->next_tag( array( 'tag_closers' => 'visit' ) ),
'Should not have found closing SCRIPT tag when closing an opener.'
);

$p = new WP_HTML_Tag_Processor( 'abc</script>' );
$this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </script> tag closer when there was no tag opener' );

$p = new WP_HTML_Tag_Processor( '<textarea>abc</textarea>' );

$p->next_tag();
$this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </textarea> tag closer' );
$this->assertTrue( $p->is_tag_closer(), 'Indicated a <textarea> tag opener is a tag closer' );
$this->assertFalse(
$p->next_tag( array( 'tag_closers' => 'visit' ) ),
'Should not have found closing TEXTAREA when closing an opener.'
);

$p = new WP_HTML_Tag_Processor( 'abc</textarea>' );
$this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </textarea> tag closer when there was no tag opener' );

$p = new WP_HTML_Tag_Processor( '<title>abc</title>' );

$p->next_tag();
$this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </title> tag closer' );
$this->assertTrue( $p->is_tag_closer(), 'Indicated a <title> tag opener is a tag closer' );
$this->assertFalse(
$p->next_tag( array( 'tag_closers' => 'visit' ) ),
'Should not have found closing TITLE when closing an opener.'
);

$p = new WP_HTML_Tag_Processor( 'abc</title>' );
$this->assertTrue( $p->next_tag( array( 'tag_closers' => 'visit' ) ), 'Did not find the </title> tag closer when there was no tag opener' );
Expand Down

0 comments on commit e83ff85

Please sign in to comment.