mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Restore map update event (fixes #167)
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user