mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 07:46:58 +02:00
Handle entities that are already deleted (fixes #672)
This commit is contained in:
@@ -7,7 +7,10 @@ iD.actions.DeleteMultiple = function(ids) {
|
||||
};
|
||||
|
||||
ids.forEach(function (id) {
|
||||
graph = actions[graph.entity(id).type](id)(graph);
|
||||
var entity = graph.entity(id);
|
||||
if (entity) { // It may have been deleted aready.
|
||||
graph = actions[entity.type](id)(graph);
|
||||
}
|
||||
});
|
||||
|
||||
return graph;
|
||||
|
||||
@@ -9,4 +9,13 @@ describe("iD.actions.DeleteMultiple", function () {
|
||||
expect(graph.entity(w.id)).to.be.undefined;
|
||||
expect(graph.entity(r.id)).to.be.undefined;
|
||||
});
|
||||
|
||||
it("deletes a way and one of its nodes", function () {
|
||||
var n = iD.Node(),
|
||||
w = iD.Way({nodes: [n.id]}),
|
||||
action = iD.actions.DeleteMultiple([w.id, n.id]),
|
||||
graph = action(iD.Graph([n, w]));
|
||||
expect(graph.entity(w.id)).to.be.undefined;
|
||||
expect(graph.entity(n.id)).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user