mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-23 00:29:50 +02:00
Don't allow deleting incomplete relations
This will fail with an "entity not found" error.
This commit is contained in:
@@ -18,4 +18,14 @@ describe("iD.actions.DeleteMultiple", function () {
|
||||
expect(graph.hasEntity(w.id)).to.be.undefined;
|
||||
expect(graph.hasEntity(n.id)).to.be.undefined;
|
||||
});
|
||||
|
||||
describe("#disabled", function () {
|
||||
it("returns the result of the first action that is disabled", function () {
|
||||
var node = iD.Node(),
|
||||
relation = iD.Relation({members: [{id: 'w'}]}),
|
||||
graph = iD.Graph([node, relation]),
|
||||
action = iD.actions.DeleteMultiple([node.id, relation.id]);
|
||||
expect(action.disabled(graph)).to.equal('incomplete_relation');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,4 +73,13 @@ describe("iD.actions.DeleteRelation", function () {
|
||||
graph = action(iD.Graph([node, way, relation]));
|
||||
expect(graph.hasEntity(node.id)).to.be.undefined;
|
||||
});
|
||||
|
||||
describe("#disabled", function() {
|
||||
it("returns 'incomplete_relation' if the relation is incomplete", function() {
|
||||
var relation = iD.Relation({members: [{id: 'w'}]}),
|
||||
graph = iD.Graph([relation]),
|
||||
action = iD.actions.DeleteRelation(relation.id);
|
||||
expect(action.disabled(graph)).to.equal('incomplete_relation');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user