Changeset 28818 for trunk/tests/phpunit/tests/formatting/Autop.php
- Timestamp:
- 06/24/2014 12:54:22 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/Autop.php
r27761 r28818 274 274 $this->assertEquals( "<p>$str</p>", trim( wpautop( $str ) ) ); 275 275 } 276 277 /** 278 * wpautop() should treat block level HTML elements as blocks. 279 */ 280 function test_that_wpautop_treats_block_level_elements_as_blocks() { 281 $blocks = array( 282 'table', 283 'thead', 284 'tfoot', 285 'caption', 286 'col', 287 'colgroup', 288 'tbody', 289 'tr', 290 'td', 291 'th', 292 'div', 293 'dl', 294 'dd', 295 'dt', 296 'ul', 297 'ol', 298 'li', 299 'pre', 300 'select', 301 'option', 302 'form', 303 'map', 304 'area', 305 'address', 306 'math', 307 'style', 308 'p', 309 'h1', 310 'h2', 311 'h3', 312 'h4', 313 'h5', 314 'h6', 315 'hr', 316 'fieldset', 317 'legend', 318 'section', 319 'article', 320 'aside', 321 'hgroup', 322 'header', 323 'footer', 324 'nav', 325 'figure', 326 'figcaption', 327 'details', 328 'menu', 329 'summary', 330 ); 331 332 $content = array(); 333 334 foreach ( $blocks as $block ) { 335 $content[] = "<$block>foo</$block>"; 336 } 337 338 $expected = join( "\n", $content ); 339 $content = join( "\n\n", $content ); // WS difference 340 341 $this->assertEquals( $expected, trim( wpautop( $content ) ) ); 342 } 343 344 /** 345 * wpautop() should autop a blockquote's contents but not the blockquote itself 346 */ 347 function test_that_wpautop_does_not_wrap_blockquotes_but_does_autop_their_contents() { 348 $content = "<blockquote>foo</blockquote>"; 349 $expected = "<blockquote><p>foo</p></blockquote>"; 350 351 $this->assertEquals( $expected, trim( wpautop( $content ) ) ); 352 } 353 354 /** 355 * wpautop() should treat inline HTML elements as inline. 356 */ 357 function test_that_wpautop_treats_inline_elements_as_inline() { 358 $inlines = array( 359 'a', 360 'em', 361 'strong', 362 'small', 363 's', 364 'cite', 365 'q', 366 'dfn', 367 'abbr', 368 'data', 369 'time', 370 'code', 371 'var', 372 'samp', 373 'kbd', 374 'sub', 375 'sup', 376 'i', 377 'b', 378 'u', 379 'mark', 380 'span', 381 'del', 382 'ins', 383 'noscript', 384 ); 385 386 $content = $expected = array(); 387 388 foreach ( $inlines as $inline ) { 389 $content[] = "<$inline>foo</$inline>"; 390 $expected[] = "<p><$inline>foo</$inline></p>"; 391 } 392 393 $content = join( "\n\n", $content ); 394 $expected = join( "\n", $expected ); 395 396 $this->assertEquals( $expected, trim( wpautop( $content ) ) ); 397 } 276 398 }
Note: See TracChangeset
for help on using the changeset viewer.