Make WordPress Core


Ignore:
Timestamp:
02/21/2017 03:41:42 AM (8 years ago)
Author:
dd32
Message:

Formatting: fix wpautop() to stop adding paragraph tags around <figcaption>.

Props azaozz, pbearne for tests.
Merges [39912], [39914] to the 4.7 branch.
Fixes #39307 for 4.7.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/tests/phpunit/tests/formatting/Autop.php

    r38592 r40091  
    535535        $this->assertEquals( $expected, trim( wpautop( $content ) ) );
    536536    }
     537
     538    /**
     539     * wpautop() should not add extra </p> before <figcaption>
     540     *
     541     * @covers ::wpautop
     542     * @uses trim
     543     *
     544     * @ticket 39307
     545     */
     546    function test_that_wpautop_doses_not_add_extra_closing_p_in_figure() {
     547        $content1 = $expected1 = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>';
     548
     549        $content2 = '<figure>
     550<img src="example.jpg" />
     551<figcaption>Caption</figcaption>
     552</figure>';
     553
     554        $expected2 = '<figure>
     555<img src="example.jpg" /><figcaption>Caption</figcaption></figure>';
     556
     557        $this->assertEquals( $expected1, trim( wpautop( $content1 ) ) );
     558        $this->assertEquals( $expected2, trim( wpautop( $content2 ) ) );
     559    }
     560
    537561}
Note: See TracChangeset for help on using the changeset viewer.