summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
51b143c)
Custom undo function is getting transformation.context as its running
context. Incrementing runCounter makes sure this node
argument (and possible others used in undo) will be refetched via
getPath on the next redo.
Until now this was happening only for transformations without its own
undo, which caused problems e.g. if redo was preceded by unaware
transformation undo.
expect(doc.root.getAttr('unaware')).to.equal('1');
});
});
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('<section t="0"></section>');
+
+ 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');
+ });
+ });
undo: function() {
if(desc.undo) {
desc.undo.call(this.context, this);
undo: function() {
if(desc.undo) {
desc.undo.call(this.context, this);
} else {
this.document.getNodeByPath(this.changeRootPath).replaceWith(this.snapshot);
}
} else {
this.document.getNodeByPath(this.changeRootPath).replaceWith(this.snapshot);
}