X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/459b6016a0622043918f1c90001532c816de88fa..f63769e206281f306f6c2cb937358837da450185:/src/smartxml/smartxml.test.js diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index e4e2724..5d1ca3e 100644 --- a/src/smartxml/smartxml.test.js +++ b/src/smartxml/smartxml.test.js @@ -1679,6 +1679,29 @@ describe('smartxml', function() { doc.redo(); expect(doc.root.getAttr('t')).to.equal('1'); }); + it('can perform undo of an operation performed after automatic transaction rollback', function() { + var doc = getDocumentFromXML('
'), + extension = {document: {transformations: { + throwingTransformation: function() { throw new Error(); } + }}}; + + doc.registerExtension(extension); + + doc.throwingTransformation(); + + doc.transaction(function() { + doc.root.setAttr('x', '2'); + }); + + expect(doc.undoStack.length).to.equal(1); + expect(doc.root.getAttr('x')).to.equal('2'); + + doc.undo(); + + expect(doc.undoStack.length).to.equal(0); + expect(doc.root.getAttr('x')).to.be.undefined; + + }); }); });