Restore map update event (fixes #167)

This commit is contained in:
John Firebaugh
2012-12-03 15:55:01 -05:00
parent f130c325ae
commit 41548c25bf
2 changed files with 27 additions and 0 deletions

View File

@@ -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;
};

View File

@@ -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");