X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/f053afa06b122dc6d6a2a0ff1dd3ac2691d79a5c..84a0c8eeefe4f8ea5da616a0527f1f958cad893c:/src/smartxml/smartxml.test.js?ds=inline 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() {