X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/9e4ef8a51fbe1e5df22334bc63276f9ffbaade73..4ff93211ebf44be111ae2c00b7ee9c843ff6d7c9:/src/smartxml/smartxml.test.js diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index cbef963..1e778ce 100644 --- a/src/smartxml/smartxml.test.js +++ b/src/smartxml/smartxml.test.js @@ -932,6 +932,7 @@ describe('smartxml', function() { expect(spy.callCount).to.equal(1); expect(event.type).to.equal('nodeMoved'); expect(event.meta.node.sameNode(appended)).to.be.true; + expect(node.document.root.sameNode(event.meta.parent)).to.equal(true, 'previous parent attached to event meta'); }); it('emits nodeAdded event when prepending new node', function() { @@ -1592,6 +1593,34 @@ describe('smartxml', function() { expect(doc.root.getAttr('unaware')).to.equal('1'); }); }); + + describe('Regression tests', function() { + it('redos correctly after running its own undo followed by unaware transformation undo', function() { + var doc = getDocumentFromXML('
'); + + doc.registerExtension({elementNode: {transformations: { + unaware: function() { + this.triggerChangeEvent(); + }, + test: { + impl: function() { + this._$.attr('t', 1); + this.triggerChangeEvent(); + }, + undo: function() { + this._$.attr('t', 0); + } + } + }}}); + doc.root.unaware(); + doc.root.test(); + doc.undo(); + doc.undo(); + doc.redo(); + doc.redo(); + expect(doc.root.getAttr('t')).to.equal('1'); + }); + }); }); });