summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d2daf48)
Handle doc.transactionStart(); doc.transactionEnd() without actual
transformations performed in between.
throw new Error('End of transaction requested, but there is no transaction in progress!');
}
this._transactionInProgress = false;
throw new Error('End of transaction requested, but there is no transaction in progress!');
}
this._transactionInProgress = false;
- this.undoStack.push(this._transactionStack);
- this._transactionStack = [];
+ if(this._transactionStack.length) {
+ this.undoStack.push(this._transactionStack);
+ this._transactionStack = [];
+ }
},
getNodeByPath: function(path) {
},
getNodeByPath: function(path) {
expect(doc.root.getAttr('test'), '3');
});
expect(doc.root.getAttr('test'), '3');
});
+ it('ignores empty transactions', function() {
+ var doc = getDocumentFromXML('<div></div>');
+ doc.startTransaction();
+ doc.endTransaction();
+ expect(doc.undoStack).to.have.length(0, 'empty transaction doesn\'t get pushed into undo stack');
+ });
+
it('doesn\'t break on optimizations', function() {
// This is a smoke test checking if optimizations made to transaction undoing
// doesnt't break anything.
it('doesn\'t break on optimizations', function() {
// This is a smoke test checking if optimizations made to transaction undoing
// doesnt't break anything.