canvas manager wip
[fnpeditor.git] / modules / documentCanvas / tests / canvas.test.js
index 386e375..a948787 100644 (file)
@@ -81,6 +81,18 @@ define([
             );\r
         });\r
         \r
+        test('split node with subnodes', function() {\r
+            var c = new canvas.Canvas('<section><header class="some.class">Fancy and nice <span>header</span> 1</header></section>');\r
+            var header = c.getNode({tag: 'header'})[0];\r
+            c.splitNode({node: header, textNodeIdx: 0, offset: 5});\r
+            assert.xmlEqual(c.toXML(), '\\r
+                <section> \\r
+                    <header class="some.class">Fancy</header>\\r
+                    <header class="some.class"> and nice <span>header</span> 1</header>\\r
+                </section>'\r
+            );\r
+        });\r
+        \r
         test('list', function() {\r
             var c = new canvas.Canvas('<section><div>Alice</div>has<div>a cat</div></section>');\r
             var div1 = c.getNode({tag:'div'})[0];\r