X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/36de4837650d53704c67a9f23a4d68b1287b03ec..6479f1b730495626b2d97c3be2fc903ff34e3a5b:/src/smartxml/smartxml.test.js?ds=sidebyside diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index 938e5f7..86f16de 100644 --- a/src/smartxml/smartxml.test.js +++ b/src/smartxml/smartxml.test.js @@ -105,6 +105,18 @@ describe('smartxml', function() { expect(node.getTagName()).to.equal('header'); expect(node.getData()).to.eql({key: 'value'}); }); + + it('can change document root tag name', function() { + var doc = getDocumentFromXML('
'); + doc.root.setTag('span'); + expect(doc.root.getTagName()).to.equal('span'); + }); + + it('keeps contents', function() { + var node = elementNodeFromXML('
'); + node.setTag('header'); + expect(node.contents()).to.have.length(1); + }); }); @@ -164,6 +176,19 @@ describe('smartxml', function() { expect(input.isEqualNode(output)).to.be.true; }); + + it('keeps entities intact', function() { + var xmlIn = '
< >
', + doc = getDocumentFromXML(xmlIn), + xmlOut = doc.toXML(); + expect(xmlOut).to.equal(xmlIn); + }); + it('keeps entities intact when they form html/xml', function() { + var xmlIn = '
<abc>
', + doc = getDocumentFromXML(xmlIn), + xmlOut = doc.toXML(); + expect(xmlOut).to.equal(xmlIn); + }); }); });