[kupu-checkins] r43481 - in kupu/trunk/kupu: common doc tests

duncan at codespeak.net duncan at codespeak.net
Fri May 18 15:36:35 CEST 2007


Author: duncan
Date: Fri May 18 15:36:35 2007
New Revision: 43481

Modified:
   kupu/trunk/kupu/common/kupucontentfilters.js
   kupu/trunk/kupu/doc/CHANGES.txt
   kupu/trunk/kupu/tests/test_xhtml.js
Log:
Strip only one trailing <br> tag.
Stop unit tests from opening the Firefox error console 3 times every time they run.

Modified: kupu/trunk/kupu/common/kupucontentfilters.js
==============================================================================
--- kupu/trunk/kupu/common/kupucontentfilters.js	(original)
+++ kupu/trunk/kupu/common/kupucontentfilters.js	Fri May 18 15:36:35 2007
@@ -681,7 +681,7 @@
                 }
                 parentNode.insertBefore(p,node);
                 parentNode.removeChild(node);
-            } else if (!node.nextSibling && (/p|div/i.test(parentNode.nodeName))) {
+            } else if (!node.nextSibling && (/p|div/i.test(parentNode.nodeName) && !(node.previousSibling&&node.previousSibling.nodeName=='br'))) {
                 parentNode.removeChild(node);
             }
         }

Modified: kupu/trunk/kupu/doc/CHANGES.txt
==============================================================================
--- kupu/trunk/kupu/doc/CHANGES.txt	(original)
+++ kupu/trunk/kupu/doc/CHANGES.txt	Fri May 18 15:36:35 2007
@@ -8,6 +8,18 @@
 
   - Media objects may now have a list of classes (specific to the portal type).
 
+  - Image drawer layout has been tidied up.
+
+  - Removed the tabindex from all the toolbar buttons and added it to
+    the iframe: this means you can tab into kupu from above without
+    dying of old age as you try to get past the toolbar. Added a
+    handler for the tab key so that pressing tab will take you to the
+    next tabstop in the form.
+
+  - Only single trailing <br> tags are stripped from p and div tags: multiple
+    <br> tags are left unchanged (so those people who insist on using
+    the to generate whitespace still can).
+
 - 1.4 Beta 6
 
   - Removed the getToolByName deprecation workround since

Modified: kupu/trunk/kupu/tests/test_xhtml.js
==============================================================================
--- kupu/trunk/kupu/tests/test_xhtml.js	(original)
+++ kupu/trunk/kupu/tests/test_xhtml.js	Fri May 18 15:36:35 2007
@@ -64,6 +64,7 @@
         }
         return false;
     }
+
     this.testExclude = function() {
         // Check that the exclude functions work as expected.
         var validator = new XhtmlValidation(this.editor);
@@ -129,6 +130,13 @@
         var expected = '<p class="blue">This is a test<br/>with more text</p>';
         this.conversionTest(data, expected);
     };
+    this.testRemoveTrailingBr3 = function() {
+        // If someone is trying to do spacing by inserting extra breaks
+        // we shouldn't remove any of them.
+        var data = '<p class="blue">This is a test<br><br>with more text<br><br></p>';
+        var expected = '<p class="blue">This is a test<br/><br/>with more text<br/><br/></p>';
+        this.conversionTest(data, expected);
+    };
     this.testFixTopLevelBr = function() {
         var data = '<p>alpha</p>beta<br><p>gamma</p>';
         var expected = '<p>alpha</p><p>beta</p><p>gamma</p>';
@@ -277,16 +285,16 @@
     this.testPWithCaptionedImg = function() {
         // Captioned images are converted to block tags so they must
         // not be inside a paragraph.
-        var data = '<p>some text<br/><img class="image-inline captioned" src="javascript:" alt="xyzzy" height="1" width="1"/>blah</p>';
-        var expected = '<p>some text</p><img class="image-inline captioned" src="javascript:" alt="xyzzy" height="1" width="1"/><p>blah</p>';
+        var data = '<p>some text<br/><img class="image-inline captioned" src="data:" alt="xyzzy" height="1" width="1"/>blah</p>';
+        var expected = '<p>some text</p><img class="image-inline captioned" src="data:" alt="xyzzy" height="1" width="1"/><p>blah</p>';
         this.conversionTest(data, expected);
         // If there is no surrounding text we don't want empty paras.
-        var data = '<p><img class="image-inline captioned" src="javascript:" alt="xyzzy" height="1" width="1"/></p>';
-        var expected = '<img class="image-inline captioned" src="javascript:" alt="xyzzy" height="1" width="1"/>';
+        var data = '<p><img class="image-inline captioned" src="data:" alt="xyzzy" height="1" width="1"/></p>';
+        var expected = '<img class="image-inline captioned" src="data:" alt="xyzzy" height="1" width="1"/>';
         this.conversionTest(data, expected);
         // But ordinary images are fine.
-        var data = '<p>some text<br/><img class="image-inline" src="javascript:" alt="xyzzy" height="1" width="1"/>blah</p>';
-        var expected = '<p>some text<br/><img class="image-inline" src="javascript:" alt="xyzzy" height="1" width="1"/>blah</p>';
+        var data = '<p>some text<br/><img class="image-inline" src="data:" alt="xyzzy" height="1" width="1"/>blah</p>';
+        var expected = '<p>some text<br/><img class="image-inline" src="data:" alt="xyzzy" height="1" width="1"/>blah</p>';
         this.conversionTest(data, expected);
     };
 


More information about the kupu-checkins mailing list