canvas api: fixing list adding
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 24 Jun 2013 10:39:14 +0000 (12:39 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 24 Jun 2013 10:39:14 +0000 (12:39 +0200)
modules/documentCanvas/canvas.js
modules/documentCanvas/tests/canvas.test.js

index eb0fd0b..848dc48 100644 (file)
@@ -147,14 +147,14 @@ Canvas.prototype.createList = function(options) {
             else {\r
                 $node = $(node);\r
             }\r
             else {\r
                 $node = $(node);\r
             }\r
-            $node.attr('wlxml-class', 'list.item');\r
+            $node.attr('wlxml-class', 'item');\r
             nodesToWrap.push($node);\r
         }\r
         if(node.isSameNode(element2.get(0)))\r
             return;\r
     });\r
     \r
             nodesToWrap.push($node);\r
         }\r
         if(node.isSameNode(element2.get(0)))\r
             return;\r
     });\r
     \r
-    var list = this._createNode('div', 'list');\r
+    var list = this._createNode('div', 'list-items');\r
     element1.before(list);\r
     \r
     nodesToWrap.forEach(function(node) {\r
     element1.before(list);\r
     \r
     nodesToWrap.forEach(function(node) {\r
index 57ad625..7515309 100644 (file)
@@ -118,8 +118,8 @@ define([
             );\r
         });\r
         \r
             );\r
         });\r
         \r
-        test('list', function() {\r
-            var c = new canvas.Canvas('<section><div>Alice</div>has<div>a cat</div></section>');\r
+        test('create list from existing nodes', function() {\r
+            var c = new canvas.Canvas('<section><div>Alice</div>has<div>a cat</div><div>some text</div></section>');\r
             var div1 = c.getNode({tag:'div'})[0];\r
             var div2 = c.getNode({tag:'div'})[1];\r
             \r
             var div1 = c.getNode({tag:'div'})[0];\r
             var div2 = c.getNode({tag:'div'})[1];\r
             \r
@@ -127,11 +127,12 @@ define([
             \r
             assert.xmlEqual(c.toXML(), '\\r
                 <section>\\r
             \r
             assert.xmlEqual(c.toXML(), '\\r
                 <section>\\r
-                    <div class="list">\\r
-                        <div class="list.item">Alice</div>\\r
-                        <div class="list.item">has</div>\\r
-                        <div class="list.item">a cat</div>\\r
+                    <div class="list.items">\\r
+                        <div class="item">Alice</div>\\r
+                        <div class="item">has</div>\\r
+                        <div class="item">a cat</div>\\r
                     </div>\\r
                     </div>\\r
+                    <div>some text</div>\\r
                 </section>');\r
 \r
         });\r
                 </section>');\r
 \r
         });\r