diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 4c9238125..cee9ab0eb 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -440,18 +440,21 @@ iD.Map = function() { map.perform = function(action) { map.history.perform(action); + map.update(); redraw(); return map; }; map.undo = function() { map.history.undo(); + map.update(); redraw(); return map; }; map.redo = function() { map.history.redo(); + map.update(); redraw(); return map; }; diff --git a/test/spec/Map.js b/test/spec/Map.js index ec8d9484d..63054d7a4 100644 --- a/test/spec/Map.js +++ b/test/spec/Map.js @@ -61,6 +61,30 @@ describe('Map', function() { }); }); + describe("update", function () { + var spy; + + beforeEach(function () { + spy = sinon.spy(); + map.on('update', spy); + }); + + it("is emitted when performing an action", function () { + map.perform(iD.actions.noop); + expect(spy).to.have.been.called; + }); + + it("is emitted when undoing an action", function () { + map.undo(); + expect(spy).to.have.been.called; + }); + + it("is emitted when redoing an action", function () { + map.redo(); + expect(spy).to.have.been.called; + }); + }); + describe("surface", function() { it("is an SVG element", function() { expect(map.surface.node().tagName).to.equal("svg");