summaryrefslogtreecommitdiff
path: root/tests/Framework
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-12-28 19:14:51 +0100
committerAleksander Machniak <alec@alec.pl>2013-12-28 19:14:51 +0100
commitc7250749ab01721b55a26d6badf4dcdbbdaf7309 (patch)
tree7e1c44bf470294545f73ad3ad7c52108631afa17 /tests/Framework
parente1bb65c6d7ed3aa7bd4be48b37f4f47931ef203d (diff)
Fix issue where deprecated syntax for HTML lists was not handled properly (#1488768)
Diffstat (limited to 'tests/Framework')
-rw-r--r--tests/Framework/Washtml.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php
index 0d050ff30..7485d4383 100644
--- a/tests/Framework/Washtml.php
+++ b/tests/Framework/Washtml.php
@@ -81,4 +81,47 @@ class Framework_Washtml extends PHPUnit_Framework_TestCase
$this->assertRegExp('|</a>|', $washed, "Invalid closing tag (#1489446)");
}
+ /**
+ * Test fixing of invalid lists nesting (#1488768)
+ */
+ function test_lists()
+ {
+ $data = array(
+ array(
+ "<ol><li>First</li><li>Second</li><ul><li>First sub</li></ul><li>Third</li></ol>",
+ "<ol><li>First</li><li>Second<ul><li>First sub</li></ul></li><li>Third</li></ol>"
+ ),
+ array(
+ "<ol><li>First<ul><li>First sub</li></ul></li></ol>",
+ "<ol><li>First<ul><li>First sub</li></ul></li></ol>",
+ ),
+ array(
+ "<ol><li>First<ol><li>First sub</li></ol></li></ol>",
+ "<ol><li>First<ol><li>First sub</li></ol></li></ol>",
+ ),
+ array(
+ "<ul><li>First</li><ul><li>First sub</li><ul><li>sub sub</li></ul></ul><li></li></ul>",
+ "<ul><li>First<ul><li>First sub<ul><li>sub sub</li></ul></li></ul></li><li></li></ul>",
+ ),
+ array(
+ "<ul><li>First</li><li>second</li><ul><ul><li>sub sub</li></ul></ul></ul>",
+ "<ul><li>First</li><li>second<ul><ul><li>sub sub</li></ul></ul></li></ul>",
+ ),
+ array(
+ "<ol><ol><ol></ol></ol></ol>",
+ "<ol><ol><ol></ol></ol></ol>",
+ ),
+ array(
+ "<div><ol><ol><ol></ol></ol></ol></div>",
+ "<div><ol><ol><ol></ol></ol></ol></div>",
+ ),
+ );
+
+ foreach ($data as $element) {
+ rcube_washtml::fix_broken_lists($element[0]);
+
+ $this->assertSame($element[1], $element[0], "Broken nested lists (#1488768)");
+ }
+ }
+
}