From a8e3ded102e02849b04f7f4eaa9d592b3bfe6c99 Mon Sep 17 00:00:00 2001 From: Oliver Sartun Date: Wed, 17 Sep 2014 16:11:01 +0200 Subject: [PATCH] Adding tests for undoAll / redoAll Tests for mixing undoAll / redoAll with regular undo / redo --- Tests/Backbone.Undo.Tests.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Tests/Backbone.Undo.Tests.js b/Tests/Backbone.Undo.Tests.js index 3d178b1..f051ba9 100644 --- a/Tests/Backbone.Undo.Tests.js +++ b/Tests/Backbone.Undo.Tests.js @@ -327,6 +327,28 @@ test("Undoing all actions", function () { UndoManager.redoAll(); deepEqual(model.toJSON(), {"t": 4}, "Calling redoAll was successful"); + + UndoManager.undo(); + UndoManager.undoAll(); + UndoManager.undo(true); + + deepEqual(model.toJSON(), {"t": 1}, "Mixing undoAll with undo doesn't cause any problems"); + + UndoManager.undoAll(); // back to the stack's beginning + + UndoManager.redo(); + UndoManager.redoAll(); + UndoManager.redo(true); + + deepEqual(model.toJSON(), {"t": 4}, "Mixing redoAll with redo doesn't cause any problems"); + + UndoManager.undoAll(); + UndoManager.undoAll(); + UndoManager.redoAll(); + UndoManager.redoAll(); + + deepEqual(model.toJSON(), {"t": 4}, "Calling undoAll and redoAll multiple times doesn't cause any problems"); + }) /**