diff --git a/test/spec/history.js b/test/spec/history.js index f45265b93..e49543421 100644 --- a/test/spec/history.js +++ b/test/spec/history.js @@ -24,6 +24,18 @@ describe("History", function () { history.perform(action); expect(history.undoAnnotation()).to.equal("action"); }); + + it("emits a change event", function () { + history.on('change', spy); + history.perform(action); + expect(spy).to.have.been.called; + }); + + it("does not emit a change event when performing a noop", function () { + history.on('change', spy); + history.perform(iD.actions.noop); + expect(spy).not.to.have.been.called; + }); }); describe("#undo", function () { @@ -38,6 +50,23 @@ describe("History", function () { history.undo(); expect(history.redoAnnotation()).to.equal("action"); }); + + it("emits a change event", function () { + history.perform(action); + history.on('change', spy); + history.undo(); + expect(spy).to.have.been.called; + }); + }); + + describe("#redo", function () { + it("emits a change event", function () { + history.perform(action); + history.undo(); + history.on('change', spy); + history.redo(); + expect(spy).to.have.been.called; + }); }); describe("#reset", function () { @@ -56,33 +85,4 @@ describe("History", function () { expect(spy).to.have.been.called; }); }); - - describe("change", function () { - it("is not emitted when performing a noop", function () { - history.on('change', spy); - history.perform(iD.actions.noop); - expect(spy).not.to.have.been.called; - }); - - it("is emitted when performing an action", function () { - history.on('change', spy); - history.perform(action); - expect(spy).to.have.been.called; - }); - - it("is emitted when undoing an action", function () { - history.perform(action); - history.on('change', spy); - history.undo(); - expect(spy).to.have.been.called; - }); - - it("is emitted when redoing an action", function () { - history.perform(action); - history.undo(); - history.on('change', spy); - history.redo(); - expect(spy).to.have.been.called; - }); - }); });