'libs/jquery-1.9.1.min',\r
'libs/underscore-min',\r
'modules/documentCanvas/transformations',\r
-'modules/documentCanvas/wlxmlNode',\r
+'modules/documentCanvas/canvasNode',\r
'libs/text!./template.html'\r
-], function($, _, transformations, wlxmlNode, template) {\r
+], function($, _, transformations, canvasNode, template) {\r
\r
'use strict';\r
\r
-var Canvas = function(xml) {\r
+var Canvas = function(html) {\r
this.dom = $(template);\r
this.content = this.dom.find('#rng-module-documentCanvas-content');\r
- this.setXML(xml);\r
-}\r
-\r
-Canvas.prototype.setXML = function(xml) {\r
- this.xml = $.trim(xml);\r
- this.content.html(transformations.fromXML.getHTMLTree(this.xml)); \r
-}\r
+ if(html) {\r
+ this.content.html(html);\r
+ }\r
+};\r
\r
-Canvas.prototype.toXML = function() {\r
- return transformations.toXML.getXML(this.content.html());\r
-}\r
+Canvas.prototype.getContent = function() {\r
+ return this.content.contents();\r
+};\r
\r
-Canvas.prototype.getNode = function(desc) {\r
+Canvas.prototype.findNodes = function(desc) {\r
var selector = '';\r
- if(desc.klass)\r
- selector += '[wlxml-class=' + desc.klass + ']';\r
- if(desc.tag)\r
- selector += '[wlxml-tag=' + desc.tag + ']';\r
+ if(typeof desc === 'string') {\r
+ selector = desc;\r
+ }\r
+ else {\r
+ if(desc.klass)\r
+ selector += '[wlxml-class=' + desc.klass + ']';\r
+ if(desc.tag)\r
+ selector += '[wlxml-tag=' + desc.tag + ']';\r
+ }\r
var toret = [];\r
this.content.find(selector).each(function() {\r
- toret.push(new wlxmlNode.Node($(this)));\r
+ toret.push(canvasNode.create($(this)));\r
});\r
return toret;\r
-}\r
-\r
-Canvas.prototype.getPreviousNode = function(options) {\r
- var element = $(this.content.find('#' + options.node.id).get(0));\r
- var prev = element.prev()\r
- if(prev.length === 0)\r
- prev = element.parent();\r
- return new wlxmlNode.Node(prev);\r
-}\r
-\r
-Canvas.prototype._createNode = function(wlxmlTag, wlxmlClass) {\r
- var toBlock = ['div', 'document', 'section', 'header'];\r
- var htmlTag = _.contains(toBlock, wlxmlTag) ? 'div' : 'span';\r
- var toret = $('<' + htmlTag + '>');\r
- toret.attr('wlxml-tag', wlxmlTag);\r
- if(wlxmlClass)\r
- toret.attr('wlxml-class', wlxmlClass);\r
- toret.attr('id', 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);}));\r
- return toret;\r
- };\r
-\r
-Canvas.prototype.insertNode = function(options) {\r
- var element = $(this.content.find('#' + options.context.id).get(0));\r
- if(options.place == 'after') {\r
- var node = this._createNode(options.tag, options.klass);\r
- element[options.place](node);\r
- return node;\r
- }\r
- else if(options.place == 'wrapText') {\r
- var elementContents = element.contents();\r
- if(elementContents.length !== 1 || elementContents.get(0).nodeType != 3)\r
- return false;\r
- var textElement = elementContents.get(0);\r
-\r
- var prefix = textElement.data.substr(0, options.offsetStart);\r
- var suffix = textElement.data.substr(options.offsetEnd);\r
- var core = textElement.data.substr(options.offsetStart, options.offsetEnd - options.offsetStart);\r
- var newNode = this._createNode(options.tag, options.klass);\r
- newNode.text(core);\r
- $(textElement).replaceWith(newNode);\r
- newNode.before(prefix);\r
- newNode.after(suffix);\r
- return newNode;\r
+};\r
+\r
+Canvas.prototype.nodeAppend = function(options) {\r
+ var element; // = $(this.content.find('#' + options.context.id).get(0));\r
+ if(options.to === 'root') {\r
+ element = this.content;\r
+ } else {\r
+ element = $(this.content.find('#' + options.to.getId()).get(0));\r
}\r
-}\r
+ element.append(options.node.dom);\r
+};\r
+\r
+Canvas.prototype.nodeInsertAfter = function(options) {\r
+ var element = $(this.content.find('#' + options.after.getId()).get(0));\r
+ element.after(options.node.dom);\r
+};\r
+\r
+Canvas.prototype.nodeWrap = function(options) {\r
+ var element = $(this.content.find('#' + options.inside.getId()).get(0));\r
\r
-Canvas.prototype.splitNode = function(options) {\r
+ var elementContents = element.contents();\r
+ if(elementContents.length !== 1 || elementContents.get(0).nodeType != 3)\r
+ return false;\r
+ var textElement = elementContents.get(0);\r
+\r
+ var prefix = textElement.data.substr(0, options.offsetStart);\r
+ var suffix = textElement.data.substr(options.offsetEnd);\r
+ var core = textElement.data.substr(options.offsetStart, options.offsetEnd - options.offsetStart);\r
+ options._with.setContent(core);\r
+\r
+ $(textElement).replaceWith(options._with.dom);\r
+ options._with.dom.before(prefix);\r
+ options._with.dom.after(suffix);\r
+};\r
+\r
+Canvas.prototype.nodeSplit = function(options) {\r
options = _.extend({textNodeIdx: 0}, options);\r
\r
- var nodeToSplit = $(this.content.find('#' + options.node.id).get(0));\r
+ var nodeToSplit = $(this.content.find('#' + options.node.getId()).get(0));\r
\r
var nodeContents = nodeToSplit.contents();\r
if(nodeContents.length === 0 || \r
passed = true;\r
});\r
\r
- var prefix = textNode.text().substr(0, options.offset);\r
- var suffix = textNode.text().substr(options.offset);\r
+ var prefix = $.trim(textNode.text().substr(0, options.offset));\r
+ var suffix = $.trim(textNode.text().substr(options.offset));\r
\r
textNode.before(prefix);\r
textNode.remove();\r
\r
- var newNode = this._createNode(nodeToSplit.attr('wlxml-tag'), nodeToSplit.attr('wlxml-class'));\r
- newNode.append(suffix);\r
+ var newNode = canvasNode.create({tag: nodeToSplit.attr('wlxml-tag'), klass: nodeToSplit.attr('wlxml-class')});\r
+ newNode.dom.append(suffix);\r
succeedingNodes.forEach(function(node) {\r
- newNode.append(node)\r
+ newNode.dom.append(node)\r
});\r
- nodeToSplit.after(newNode);\r
+ nodeToSplit.after(newNode.dom);\r
return newNode;\r
-}\r
+};\r
\r
-Canvas.prototype.removeNode = function(options) {\r
- var toRemove = $(this.content.find('#' + options.node.id).get(0));\r
+Canvas.prototype.nodeRemove = function(options) {\r
+ var toRemove = $(this.content.find('#' + options.node.getId()).get(0));\r
toRemove.remove();\r
+};\r
\r
-}\r
-\r
-Canvas.prototype.createList = function(options) {\r
- var element1 = $(this.content.find('#' + options.start.id).get(0));\r
- var element2 = $(this.content.find('#' + options.end.id).get(0));\r
+Canvas.prototype.listCreate = function(options) {\r
+ var element1 = $(this.content.find('#' + options.start.getId()).get(0));\r
+ var element2 = $(this.content.find('#' + options.end.getId()).get(0));\r
if(!element1.parent().get(0).isSameNode(element2.parent().get(0)))\r
return false;\r
\r
element1 = element2;\r
element2 = tmp;\r
}\r
- \r
\r
var nodesToWrap = [];\r
\r
if(place === 'inside') {\r
var $node;\r
if(node.nodeType === 3) {\r
- $node = canvas._createNode('div').text(node.data);\r
+ $node = canvasNode.create({tag: 'div', content: $.trim(node.data)}).dom; //canvas._createNode('div').text(node.data);\r
$(node).remove();\r
}\r
else {\r
return false;\r
});\r
\r
- var list = this._createNode('div', 'list-items');\r
+ var list = canvasNode.create({tag: 'div', klass: 'list-items'}).dom; //this._createNode('div', 'list-items');\r
element1.before(list);\r
\r
nodesToWrap.forEach(function(node) {\r
node.remove();\r
list.append(node);\r
});\r
-}\r
+};\r
\r
-Canvas.prototype.removeList = function(options) {\r
- var pointerElement = $(this.content.find('#' + options.pointer.id));\r
- var listElement = options.pointer.klass === 'list-items' ? pointerElement : \r
+Canvas.prototype.listRemove = function(options) {\r
+ var pointerElement = $(this.content.find('#' + options.pointer.getId()));\r
+ var listElement = options.pointer.getClass() === 'list-items' ? pointerElement : \r
pointerElement.parent('[wlxml-class="list-items"][wlxml-tag]');\r
\r
listElement.find('[wlxml-class=item]').each(function() {\r
- $(this).attr('wlxml-class', '');\r
- });;\r
+ $(this).removeAttr('wlxml-class');\r
+ });\r
listElement.children().unwrap();\r
- \r
-}\r
+};\r
+\r
+Canvas.prototype.getPrecedingNode = function(options) {\r
+ var element = $(this.content.find('#' + options.node.getId()).get(0));\r
+ var prev = element.prev()\r
+ if(prev.length === 0)\r
+ prev = element.parent();\r
+ return canvasNode.create(prev);\r
+};\r
\r
-Canvas.prototype.insideList = function(options) {\r
+Canvas.prototype.nodeInsideList = function(options) {\r
if(options.pointer) {\r
- if(options.pointer.klass === 'list-items' || options.pointer.klass === 'item')\r
+ if(options.pointer.getClass() === 'list-items' || options.pointer.getClass() === 'item')\r
return true;\r
- var pointerElement = $(this.content.find('#' + options.pointer.id));\r
- return pointerElement.parents('list-items').length > 0;\r
+ var pointerElement = $(this.content.find('#' + options.pointer.getId()));\r
+ return pointerElement.parents('list-items, item').length > 0;\r
}\r
return false;\r
-}\r
+};\r
\r
\r
-return {Canvas: Canvas, Node: Node};\r
+return {\r
+ create: function(desc) { return new Canvas(desc); }\r
+};\r
\r
});
\ No newline at end of file
'libs/jquery-1.9.1.min',\r
'libs/chai', \r
'./utils.js',\r
-'modules/documentCanvas/canvas'\r
-], function($, chai, utils, canvas) {\r
+'modules/documentCanvas/canvas',\r
+'modules/documentCanvas/canvasNode'\r
+], function($, chai, utils, canvas, canvasNode) {\r
\r
'use strict';\r
\r
var assert = chai.assert;\r
+ var assertDomEqual = utils.assertDomEqual;\r
\r
- assert.xmlEqual = function(lhsText, rhsText) {\r
- var cleanLhs = utils.cleanUp(lhsText);\r
- var cleanRhs = utils.cleanUp(rhsText);\r
- \r
- var lhs = $(cleanLhs);\r
- var rhs = $(cleanRhs);\r
- \r
- this.equal(lhs.length, 1);\r
- this.equal(rhs.length, 1);\r
- \r
- lhs = lhs.get(0);\r
- rhs = rhs.get(0);\r
- \r
- var test = lhs.isEqualNode(rhs);\r
- if(!test) {\r
- console.log(cleanLhs);\r
- console.log(cleanRhs); \r
- }\r
- return this.ok(test, 'xmls are equal');\r
- };\r
\r
- var retrievingTest = function(title, xml) {\r
- test(title, function() {\r
- var c = new canvas.Canvas(xml);\r
- assert.xmlEqual(c.toXML(), xml); \r
+ suite('Quering nodes', function() {\r
+ test('getting preceding node', function() {\r
+ var c = canvas.create('<div wlxml-tag="section"><div wlxml-tag="p">a</div><div wlxml-tag="p">b</div></div>');\r
+ var secondP = c.findNodes({tag: 'p'})[1];\r
+ var firstP = c.getPrecedingNode({node: secondP});\r
+ assert.equal(firstP.getContent(), 'a');\r
});\r
- };\r
- \r
- suite('Basic document retrieving', function() {\r
- test('empty document', function() {\r
- var c = new canvas.Canvas('');\r
- assert.equal(c.toXML(), '');\r
+ \r
+ test('pervious node of node without "previous siblings" is its parent', function() {\r
+ var c = canvas.create('<div wlxml-tag="section"><div wlxml-tag="p">a</div></div>');\r
+ var paragraph = c.findNodes({tag: 'p'})[0];\r
+ assert.equal(c.getPrecedingNode({node: paragraph}).getTag(), 'section');\r
});\r
- retrievingTest('empty tag', '<section></section>');\r
- retrievingTest('tag with content', '<section>Some text</section>');\r
- retrievingTest('tag with class', '<section class="some.class"></section>');\r
+ \r
});\r
\r
- suite('Nodes', function() {\r
- test('getting nodes via selector', function() {\r
- var c = new canvas.Canvas('<section><header class="some.class">Header 1</header></section>');\r
- var header = c.getNode({tag: 'header'})[0];\r
- assert.equal(header.tag, 'header');\r
- assert.equal(header.klass, 'some-class');\r
- });\r
+ \r
+ suite('Inserting nodes', function() {\r
+ test('append node to root', function() {\r
+ var c = canvas.create();\r
+ var node = canvasNode.create({tag: 'header', klass: 'some-class'});\r
+ c.nodeAppend({node: node, to: 'root'});\r
+ assertDomEqual(c.getContent(), '<div wlxml-tag="header" wlxml-class="some-class">');\r
+ }); \r
\r
- test('getting previous node', function() {\r
- var c = new canvas.Canvas('<section><div class="some.class">Div 1</div><div class="some.other.class">Div 2</div></section>');\r
- var secondDiv = c.getNode({tag: 'div'})[1];\r
- var firstDiv = c.getPreviousNode({node: secondDiv});\r
- assert.equal(firstDiv.klass, 'some-class');\r
- })\r
+ test('append node to another node', function() {\r
+ var c = canvas.create('<div wlxml-tag="section"></div>');\r
+ var node = canvasNode.create({tag: 'header', klass: 'some-class'});\r
+ var to = c.findNodes('div')[0];\r
+ c.nodeAppend({node: node, to: to});\r
+ assertDomEqual(c.getContent(), '<div wlxml-tag="section"><div wlxml-tag="header" wlxml-class="some-class"></div></div>');\r
+ });\r
\r
- test('pervious node of node without "previous siblings" is its parent', function() {\r
- var c = new canvas.Canvas('<section><div class="some.class">Div 1</div></section>');\r
- var div = c.getNode({tag: 'div'})[0];\r
- var section = c.getPreviousNode({node: div});\r
- assert.equal(section.tag, 'section');\r
- })\r
- \r
- test('inserting after', function() {\r
- var c = new canvas.Canvas('<section><header>Header 1</header></section>');\r
- var header = c.getNode({tag: 'header'})[0];\r
- c.insertNode({place: 'after', context: header, tag: 'div', klass: 'some.class'});\r
- assert.xmlEqual(c.toXML(), '<section><header>Header 1</header><div class="some.class"></div></section>');\r
+ test('insert node after another node', function() {\r
+ var c = canvas.create('<div wlxml-tag="section"></div>');\r
+ var node = canvasNode.create({tag: 'header', klass: 'some-class'});\r
+ var after = c.findNodes('div')[0];\r
+ c.nodeInsertAfter({node: node, after: after});\r
+ assertDomEqual(c.getContent(), '<div wlxml-tag="section"></div><div wlxml-tag="header" wlxml-class="some-class"></div>'); \r
});\r
\r
test('wrap text in node', function() {\r
- var c = new canvas.Canvas('<section><header>Header 1</header></section>');\r
- var header = c.getNode({tag: 'header'})[0];\r
- c.insertNode({place: 'wrapText', context: header, tag: 'span', klass: 'url', offsetStart: 1, offsetEnd: 6});\r
- assert.xmlEqual(c.toXML(), '<section><header>H<span class="url">eader</span> 1</header></section>');\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 wrapper = canvasNode.create({tag: 'aside'});\r
+ c.nodeWrap({inside: header, _with: wrapper, offsetStart: 1, offsetEnd: 6})\r
+ assertDomEqual(c.getContent(), '<div wlxml-tag="section"><div wlxml-tag="header">H<span wlxml-tag="aside">eader</span> 1</div></div>');\r
});\r
\r
test('split node', function() {\r
- 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
});\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
+ var c = canvas.create(utils.cleanUp('\\r
+ <div wlxml-tag="section">\\r
+ <div wlxml-tag="header">Fancy and nice<span wlxml-tag="aside">header</span> 1</div>\\r
+ </div>'));\r
+ var header = c.findNodes({tag: 'header'})[0];\r
+ var newNode = c.nodeSplit({node: header, offset: 5});\r
+ assertDomEqual(c.getContent(), utils.cleanUp('\\r
+ <div wlxml-tag="section">\\r
+ <div wlxml-tag="header">Fancy</div>\\r
+ <div wlxml-tag="header">and nice<span wlxml-tag="aside">header</span> 1</div>\\r
+ </div>'));\r
});\r
\r
test('remove node', function() {\r
- var c = new canvas.Canvas('<section><header class="some.class">Fancy and nice <span>header</span> 1</header></section>');\r
- var span = c.getNode({tag: 'span'})[0];\r
- var siblings = c.removeNode({node:span});\r
- assert.xmlEqual(c.toXML(), '\\r
- <section>\\r
- <header class="some.class">Fancy and nice 1</header>\\r
- </section>'\r
- );\r
+ var c = canvas.create('<div wlxml-tag="section"><span wlxml-tag="span">some text</span></div>');\r
+ var span = c.findNodes({tag: 'span'})[0];\r
+ c.nodeRemove({node: span});\r
+ assertDomEqual(c.getContent(), '<div wlxml-tag="section"></div>');\r
});\r
- \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
+ \r
+ \r
+ suite('Lists', function() {\r
+ test('create from existing nodes', function() {\r
+ var c = canvas.create(utils.cleanUp('\\r
+ <div wlxml-tag="section">\\r
+ <div wlxml-tag="div">alice</div>\\r
+ has\\r
+ <div wlxml-tag="div">a</div>\\r
+ <div wlxml-tag="div">cat</div>\\r
+ <div wlxml-tag="div">or not</div>\\r
+ </div>'\r
+ ));\r
+ \r
+ var div_alice = c.findNodes({tag: 'div'})[0];\r
+ var div_cat = c.findNodes({tag:'div'})[2];\r
\r
- c.createList({start: div1, end: div2});\r
+ c.listCreate({start: div_alice, end: div_cat});\r
\r
- assert.xmlEqual(c.toXML(), '\\r
- <section>\\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
+ assertDomEqual(c.getContent(), utils.cleanUp('\\r
+ <div wlxml-tag="section">\\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">has</div>\\r
+ <div wlxml-tag="div" wlxml-class="item">a</div>\\r
+ <div wlxml-tag="div" wlxml-class="item">cat</div>\\r
</div>\\r
- <div>some text</div>\\r
- </section>');\r
-\r
+ <div wlxml-tag="div">or not</div>\\r
+ </div>'));\r
});\r
\r
- test('create list from existing nodes reverse', 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
- c.createList({start: div2, end: div1});\r
+ test('create from existing nodes - start/end order doesn\'t matter', function() {\r
+ var html = utils.cleanUp('\\r
+ <div wlxml-tag="div">alice</div>\\r
+ <div wlxml-tag="div">cat</div>');\r
+ var expected = 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>');\r
+ \r
+ var c = canvas.create(html);\r
+ var div_alice = c.findNodes({tag: 'div'})[0];\r
+ var div_cat = c.findNodes({tag:'div'})[1];\r
+ c.listCreate({start: div_cat, end: div_alice});\r
+ assertDomEqual(c.getContent(), expected);\r
\r
- assert.xmlEqual(c.toXML(), '\\r
- <section>\\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>some text</div>\\r
- </section>');\r
-\r
+ c = canvas.create(html);\r
+ div_alice = c.findNodes({tag: 'div'})[0];\r
+ div_cat = c.findNodes({tag:'div'})[1];\r
+ c.listCreate({start: div_alice, end: div_cat});\r
+ assertDomEqual(c.getContent(), expected);\r
});\r
\r
- test('remove list', function() {\r
- var xml = '\\r
- <section>\\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
+ test('remove', function() {\r
+ var c = canvas.create(utils.cleanUp('\\r
+ <div wlxml-tag="section">\\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>\\r
- <div>some text</div>\\r
- </section>';\r
- var c = new canvas.Canvas(xml);\r
- var item = c.getNode({klass: 'item'})[1];\r
- c.removeList({pointer: item});\r
- assert.xmlEqual(c.toXML(), '\\r
- <section>\\r
- <div>Alice</div>\\r
- <div>has</div>\\r
- <div>a cat</div>\\r
- <div>some text</div>\\r
- </section>');\r
+ </div>'));\r
+ var item = c.findNodes({klass: 'item'})[1];\r
+ c.listRemove({pointer: item});\r
+ assertDomEqual(c.getContent(), utils.cleanUp('\\r
+ <div wlxml-tag="section">\\r
+ <div wlxml-tag="div">alice</div>\\r
+ <div wlxml-tag="div">cat</div>\\r
+ </div>'));\r
});\r
});\r
-\r
});
\ No newline at end of file