Make WordPress Core


Ignore:
Timestamp:
02/29/2016 04:41:03 AM (10 years ago)
Author:
SergeyBiryukov
Message:

Formatting: In sanitize_title_with_dashes(), convert &nbsp, &ndash, and &mdash HTML entities to hyphens on save.

Props polevaultweb for initial patch.
Fixes #31790.

File:
1 edited

Legend:

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

    r30515 r36775  
    6464    }
    6565
     66    /**
     67     * @ticket 31790
     68     */
     69    function test_replaces_nbsp_entities() {
     70        $this->assertEquals("dont-break-the-space", sanitize_title_with_dashes("don't break the space", '', 'save'));
     71    }
     72
    6673    function test_replaces_ndash_mdash() {
    6774        $this->assertEquals("do-the-dash", sanitize_title_with_dashes("Do – the Dash", '', 'save'));
    6875        $this->assertEquals("do-the-dash", sanitize_title_with_dashes("Do the — Dash", '', 'save'));
     76    }
     77
     78    /**
     79     * @ticket 31790
     80     */
     81    function test_replaces_ndash_mdash_entities() {
     82        $this->assertEquals("do-the-dash", sanitize_title_with_dashes("Do – the – Dash", '', 'save'));
     83        $this->assertEquals("do-the-dash", sanitize_title_with_dashes("Do — the — Dash", '', 'save'));
    6984    }
    7085
Note: See TracChangeset for help on using the changeset viewer.