Dennis1993
2013-07-26 4bf322d256d0460a2df5c03b1e173f6ccd9a6eb3
tests/Framework/Washtml.php
@@ -18,11 +18,54 @@
            .'<a href="vbscript:alert(document.cookie)">Internet Explorer</a></p>';
        $washer = new rcube_washtml;
        $washed = $washer->wash($html);
        $this->assertNotRegExp('/data:text/', $washed, "Remove data:text/html links");
        $this->assertNotRegExp('/vbscript:/', $washed, "Remove vbscript: links");
    }
    /**
     * Test fixing of invalid href (#1488940)
     */
    function test_href()
    {
        $html = "<p><a href=\"\nhttp://test.com\n\">Firefox</a>";
        $washer = new rcube_washtml;
        $washed = $washer->wash($html);
        $this->assertRegExp('|href="http://test.com">|', $washed, "Link href with newlines (#1488940)");
    }
    /**
     * Test handling HTML comments
     */
    function test_comments()
    {
        $washer = new rcube_washtml;
        $html   = "<!--[if gte mso 10]><p>p1</p><!--><p>p2</p>";
        $washed = $washer->wash($html);
        $this->assertEquals('<!-- node type 8 --><!-- html ignored --><!-- body ignored --><p>p2</p>', $washed, "HTML conditional comments (#1489004)");
        $html   = "<!--TestCommentInvalid><p>test</p>";
        $washed = $washer->wash($html);
        $this->assertEquals('<!-- html ignored --><!-- body ignored --><p>test</p>', $washed, "HTML invalid comments (#1487759)");
    }
    /**
     * Test fixing of invalid self-closing elements (#1489137)
     */
    function test_self_closing()
    {
        $html = "<textarea>test";
        $washer = new rcube_washtml;
        $washed = $washer->wash($html);
        $this->assertRegExp('|<textarea>test</textarea>|', $washed, "Self-closing textarea (#1489137)");
    }
}