Hook into undos in a different way

This way doesn't depend on details of keybindings and
the undo button.

Also, implement this in DrawArea mode.
This commit is contained in:
John Firebaugh
2013-01-22 14:42:29 -05:00
parent ff15aa8e7b
commit 814c3608db
4 changed files with 40 additions and 19 deletions
+15
View File
@@ -83,6 +83,13 @@ describe("iD.History", function () {
expect(history.redoAnnotation()).to.equal("annotation");
});
it("emits an undone event", function () {
history.perform(action);
history.on('undone', spy);
history.undo();
expect(spy).to.have.been.called;
});
it("emits a change event", function () {
history.perform(action);
history.on('change', spy);
@@ -92,6 +99,14 @@ describe("iD.History", function () {
});
describe("#redo", function () {
it("emits an redone event", function () {
history.perform(action);
history.undo();
history.on('change', spy);
history.redo();
expect(spy).to.have.been.called;
});
it("emits a change event", function () {
history.perform(action);
history.undo();