X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/92f4bc991bbd9f8ba67f8dd25d3130845c5c5b72..de1034273c0aa6897014dbfb6c6c92d809fd0556:/src/smartxml/smartxml.test.js?ds=sidebyside diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index 2666ae2..09fdfeb 100644 --- a/src/smartxml/smartxml.test.js +++ b/src/smartxml/smartxml.test.js @@ -302,6 +302,19 @@ describe('smartxml', function() { expect(node.contents()[2].getText()).to.equal(' a cat!'); }); + it('unwrap single node from its parent', function() { + var doc = getDocumentFromXML('
'), + div = doc.root, + a = div.contents()[0], + b = a.contents()[0]; + + var parent = b.unwrap(); + + expect(parent.sameNode(div)).to.equal(true, 'returns new parent'); + expect(div.contents()).to.have.length(1, 'root contains only one node'); + expect(div.contents()[0].sameNode(b)).to.equal(true, 'node got unwrapped'); + }); + describe('Wrapping text', function() { it('wraps text spanning multiple sibling TextNodes', function() { var section = elementNodeFromXML('
Alice has a small cat
'),