- var c = new canvas.Canvas('<section><header class="some.class">Header 1</header></section>');\r
- var header = c.getNode({tag: 'header'})[0];\r
- c.splitNode({node: header, offset: 4});\r
- assert.xmlEqual(c.toXML(), '\\r
- <section> \\r
- <header class="some.class">Head</header>\\r
- <header class="some.class">er 1</header>\\r
- </section>'\r
- );\r
+ var c = canvas.create('<div wlxml-tag="section"><div wlxml-tag="header">Header 1</div></div>');\r
+ var header = c.findNodes({tag: 'header'})[0];\r
+ var newNode = c.nodeSplit({node: header, offset: 4});\r
+ assertDomEqual(c.getContent(), utils.cleanUp('\\r
+ <div wlxml-tag="section">\\r
+ <div wlxml-tag="header">Head</div>\\r
+ <div wlxml-tag="header">er 1</div>\\r
+ </div>'));\r
+ assert.ok(newNode.isSame(c.findNodes({tag: 'header'})[1]));\r
+ });\r
+ \r
+ test('split root node', function() {\r
+ var c = canvas.create('<div wlxml-tag="header">cat</div>');\r
+ var header = c.findNodes({tag: 'header'})[0];\r
+ var newNode = c.nodeSplit({node: header, offset: 1});\r
+ assertDomEqual(c.getContent(), utils.cleanUp('\\r
+ <div wlxml-tag="header">c</div>\\r
+ <div wlxml-tag="header">at</div>'));\r
+ assert.ok(newNode.isSame(c.findNodes({tag: 'header'})[1]));\r