mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 19:24:34 +00:00
Formatting: maintain the content of HTML comments when they contain <object> tags. Add more tests for wpaitop().
Props miqrogroove. Fixes #33645 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@33955 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -328,6 +328,7 @@ Paragraph two.';
|
||||
'summary',
|
||||
);
|
||||
|
||||
// Check whitespace normalization.
|
||||
$content = array();
|
||||
|
||||
foreach ( $blocks as $block ) {
|
||||
@@ -335,9 +336,37 @@ Paragraph two.';
|
||||
}
|
||||
|
||||
$expected = join( "\n", $content );
|
||||
$content = join( "\n\n", $content ); // WS difference
|
||||
$input = join( "\n\n", $content ); // WS difference
|
||||
|
||||
$this->assertEquals( $expected, trim( wpautop( $content ) ) );
|
||||
$this->assertEquals( $expected, trim( wpautop( $input ) ) );
|
||||
|
||||
$input = join( "", $content ); // WS difference
|
||||
|
||||
$this->assertEquals( $expected, trim( wpautop( $input ) ) );
|
||||
|
||||
// Check whitespace addition.
|
||||
$content = array();
|
||||
|
||||
foreach ( $blocks as $block ) {
|
||||
$content[] = "<$block/>";
|
||||
}
|
||||
|
||||
$expected = join( "\n", $content );
|
||||
$input = join( "", $content );
|
||||
|
||||
$this->assertEquals( $expected, trim( wpautop( $input ) ) );
|
||||
|
||||
// Check whitespace addition with attributes.
|
||||
$content = array();
|
||||
|
||||
foreach ( $blocks as $block ) {
|
||||
$content[] = "<$block attr='value'>foo</$block>";
|
||||
}
|
||||
|
||||
$expected = join( "\n", $content );
|
||||
$input = join( "", $content );
|
||||
|
||||
$this->assertEquals( $expected, trim( wpautop( $input ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -420,6 +449,14 @@ Paragraph two.';
|
||||
"Hello <!-- a\nhref='world' -->",
|
||||
"<p>Hello <!-- a\nhref='world' --></p>\n",
|
||||
),
|
||||
array(
|
||||
"Hello <!-- <object>\n<param>\n<param>\n<embed>\n</embed>\n</object>\n -->",
|
||||
"<p>Hello <!-- <object>\n<param>\n<param>\n<embed>\n</embed>\n</object>\n --></p>\n",
|
||||
),
|
||||
array(
|
||||
"Hello <!-- <object>\n<param/>\n<param/>\n<embed>\n</embed>\n</object>\n -->",
|
||||
"<p>Hello <!-- <object>\n<param/>\n<param/>\n<embed>\n</embed>\n</object>\n --></p>\n",
|
||||
),
|
||||
/* Block elements inside comments will fail this test in all versions, it's not a regression.
|
||||
array(
|
||||
"Hello <!-- <hr> a\nhref='world' -->",
|
||||
|
||||
Reference in New Issue
Block a user