X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/aba92db36cedd657b0c8c0637aa4aae7b573f023..643d726b32f530502411247a087274284e3f9c3a:/src/smartxml/smartxml.test.js?ds=sidebyside diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index 6b2f91d..b50da7f 100644 --- a/src/smartxml/smartxml.test.js +++ b/src/smartxml/smartxml.test.js @@ -240,6 +240,29 @@ describe('smartxml', function() { }); }); }); + + describe('Putting nodes around', function() { + it('will not allow to put node before or after root node', function() { + var doc = getDocumentFromXML(''), + spy = sinon.spy(), + root = doc.root, + result; + + doc.on('change', spy); + + result = doc.root.before({tagName: 'test'}); + + expect(spy.callCount).to.equal(0); + expect(result).to.undefined; + + result = doc.root.after({tagName: 'test'}); + + expect(spy.callCount).to.equal(0); + expect(result).to.undefined; + + expect(doc.root.sameNode(root)); + }); + }); }); describe('Basic TextNode properties', function() {