WordPress.org

Make WordPress Core

Changeset 442 in tests


Ignore:
Timestamp:
09/21/11 08:49:46 (3 years ago)
Author:
duck_
Message:

Ensure that wp_trim_words() strips the content of script and style tags. See #WP18726.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_formatting.php

    r441 r442  
    11481148    } 
    11491149 
     1150    // #18726 
     1151    function test_strips_script_and_style_content() { 
     1152        $trimmed = 'This text contains. It should go.'; 
     1153 
     1154        $text = 'This text contains<script>alert(" Javascript");</script>. It should go.'; 
     1155        $this->assertEquals( $trimmed, wp_trim_words( $text ) ); 
     1156 
     1157        $text = 'This text contains<style>#css { width:expression(alert("css")) }</style>. It should go.'; 
     1158        $this->assertEquals( $trimmed, wp_trim_words( $text ) );         
     1159    } 
     1160 
    11501161    function test_doesnt_trim_short_text() { 
    11511162        $text = 'This is some short text.'; 
Note: See TracChangeset for help on using the changeset viewer.