File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
tests/phpunit/tests/formatting Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -223,4 +223,21 @@ public function test_wp_trim_excerpt_does_not_restore_do_blocks_if_previously_un
223223 // Assert that the filter callback was not restored after running 'the_content'.
224224 $ this ->assertFalse ( has_filter ( 'the_content ' , 'do_blocks ' ) );
225225 }
226+
227+ /**
228+ * Tests that by default all HTML is stripped from the excerpt.
229+ *
230+ * @ticket 12084
231+ */
232+ public function test_excerpt_allowed_tags_default_strips_all_html () {
233+ $ post = self ::factory ()->post ->create (
234+ array (
235+ 'post_content ' => '<p>Hello <strong>world</strong>.</p> ' ,
236+ )
237+ );
238+
239+ $ excerpt = wp_trim_excerpt ( '' , $ post );
240+
241+ $ this ->assertStringNotContainsString ( '< ' , $ excerpt , 'Default excerpt should contain no HTML tags. ' );
242+ }
226243}
You can’t perform that action at this time.
0 commit comments