Removing unused code
[fnpeditor.git] / modules / documentCanvas / tests / canvas.test.js
index fc842e5..d336192 100644 (file)
@@ -186,5 +186,64 @@ define([
             assert.ok(c.nodeInsideList({node: c.findNodes({klass: 'item'})[1]}), 'item is inside a list');\r
             assert.ok(c.nodeInsideList({node: c.findNodes({tag: 'span'})[0]}), 'things nested in item are inside a list');\r
         });\r
+        \r
+        test('moving items to nested list', function() {\r
+            var listHTML = utils.cleanUp('\\r
+                    <div wlxml-tag="div" wlxml-class="list-items">\\r
+                        <div wlxml-tag="div" wlxml-class="item">alice</div>\\r
+                        <div wlxml-tag="div" wlxml-class="item">cat</div>\\r
+                        <div wlxml-tag="div" wlxml-class="item">dog</div>\\r
+                        <div wlxml-tag="div" wlxml-class="item">bee</div>\\r
+                    </div>');\r
+            var c = canvas.create(listHTML);\r
+            var items = c.findNodes({klass: 'item'});\r
+            var cat_item = items[1];\r
+            var dog_item = items[2];\r
+            \r
+            c.listCreate({start: cat_item, end: dog_item});\r
+            \r
+            assertDomEqual(c.getContent(), utils.cleanUp('\\r
+                    <div wlxml-tag="div" wlxml-class="list-items">\\r
+                        <div wlxml-tag="div" wlxml-class="item">alice</div>\\r
+                        <div wlxml-tag="div" wlxml-class="item" class="canvas-silent-item">\\r
+                            <div wlxml-tag="div" wlxml-class="list-items">\\r
+                                <div wlxml-tag="div" wlxml-class="item">cat</div>\\r
+                                <div wlxml-tag="div" wlxml-class="item">dog</div>\\r
+                            </div>\\r
+                        </div>\\r
+                        <div wlxml-tag="div" wlxml-class="item">bee</div>\\r
+                    </div>'\r
+            ));\r
+        });\r
+        \r
+        test('removing nested list', function() {\r
+            var nestedList = utils.cleanUp('\\r
+                    <div wlxml-tag="div" wlxml-class="list-items">\\r
+                        <div wlxml-tag="div" wlxml-class="item">alice</div>\\r
+                        <div wlxml-tag="div" wlxml-class="item">\\r
+                            <div wlxml-tag="div" wlxml-class="list-items">\\r
+                                <div wlxml-tag="div" wlxml-class="item">cat</div>\\r
+                                <div wlxml-tag="div" wlxml-class="item">dog</div>\\r
+                            </div>\\r
+                        </div>\\r
+                        <div wlxml-tag="div" wlxml-class="item">bee</div>\\r
+                    </div>');\r
+                    \r
+            var c = canvas.create(nestedList);\r
+            var dog_item = c.findNodes('[wlxml-class=list-items] [wlxml-class=list-items] > div')[1];\r
+            assert.equal(dog_item.getContent(), 'dog');\r
+            \r
+            c.listRemove({pointer: dog_item});\r
+            \r
+            assertDomEqual(c.getContent(), utils.cleanUp('\\r
+                    <div wlxml-tag="div" wlxml-class="list-items">\\r
+                        <div wlxml-tag="div" wlxml-class="item">alice</div>\\r
+                        <div wlxml-tag="div" wlxml-class="item">cat</div>\\r
+                        <div wlxml-tag="div" wlxml-class="item">dog</div>\\r
+                        <div wlxml-tag="div" wlxml-class="item">bee</div>\\r
+                    </div>'));\r
+            \r
+            \r
+        });\r
     });\r
 });
\ No newline at end of file