Make WordPress Core


Ignore:
Timestamp:
06/10/2014 02:08:05 AM (11 years ago)
Author:
wonderboymusic
Message:

In wptexturize(), treat   like whitespace when texturizing hyphens.

Adds unit tests.

Props redsweater, miqrogroove.
Fixes #23185.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/WPTexturize.php

    r27839 r28718  
    188188     */
    189189    function test_spaces_around_hyphens() {
     190        $nbsp = "\xC2\xA0";
     191
    190192        $this->assertEquals( ' – ', wptexturize( ' - ' ) );
    191193        $this->assertEquals( ' – ', wptexturize( ' - ' ) );
    192194        $this->assertEquals( ' – ', wptexturize( ' - ' ) );
    193195        $this->assertEquals( ' – ', wptexturize( ' - ') );
     196        $this->assertEquals( "$nbsp–$nbsp", wptexturize( "$nbsp-$nbsp" ) );
     197        $this->assertEquals( " –$nbsp", wptexturize( " -$nbsp" ) );
     198        $this->assertEquals( "$nbsp– ", wptexturize( "$nbsp- ") );
    194199
    195200        $this->assertEquals( ' — ', wptexturize( ' -- ' ) );
     
    197202        $this->assertEquals( ' — ', wptexturize( ' -- ' ) );
    198203        $this->assertEquals( ' — ', wptexturize( ' -- ') );
     204        $this->assertEquals( "$nbsp—$nbsp", wptexturize( "$nbsp--$nbsp" ) );
     205        $this->assertEquals( " —$nbsp", wptexturize( " --$nbsp" ) );
     206        $this->assertEquals( "$nbsp— ", wptexturize( "$nbsp-- ") );
    199207    }
    200208
     
    930938            array(
    931939                "word xn– word",
    932                 "word xn-- word",
     940                "word xn– word",
    933941            ),
    934942            array(
    935943                "wordxn–word",
     944                "wordxn–word",
     945            ),
     946            array(
     947                "wordxn--word",
    936948                "wordxn--word",
    937949            ),
Note: See TracChangeset for help on using the changeset viewer.