summaryrefslogtreecommitdiff
path: root/tests/Framework/Washtml.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-22 10:23:39 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-22 10:23:39 +0100
commit71cae613f0e71cb5aa5dbdf82719f5ecc694af03 (patch)
tree35f9e22cccac430cda94d8c7bd2aa78327e04008 /tests/Framework/Washtml.php
parentda595a50278bf45076739ecef2e6af0e32410060 (diff)
Added two tests for HTML comments handling in rcube_washtml class
Diffstat (limited to 'tests/Framework/Washtml.php')
-rw-r--r--tests/Framework/Washtml.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php
index 6f4aa9783..cd443266f 100644
--- a/tests/Framework/Washtml.php
+++ b/tests/Framework/Washtml.php
@@ -18,7 +18,6 @@ class Framework_Washtml extends PHPUnit_Framework_TestCase
.'<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");
@@ -33,10 +32,27 @@ class Framework_Washtml extends PHPUnit_Framework_TestCase
$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('<!-- 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)");
+ }
+
}