mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-31 20:21:36 +02:00
Split remove action into DeleteWay and DeleteNode
This commit is contained in:
+4
-2
@@ -47,9 +47,10 @@
|
||||
<script src='../js/id/actions/add_way_node.js'></script>
|
||||
<script src='../js/id/actions/change_tags.js'></script>
|
||||
<script src='../js/id/actions/change_way_direction.js'></script>
|
||||
<script src="../js/id/actions/delete_node.js"></script>
|
||||
<script src="../js/id/actions/delete_way.js"></script>
|
||||
<script src='../js/id/actions/move.js'></script>
|
||||
<script src='../js/id/actions/noop.js'></script>
|
||||
<script src='../js/id/actions/remove.js'></script>
|
||||
<script src='../js/id/actions/remove_relation_entity.js'></script>
|
||||
<script src='../js/id/actions/remove_way_node.js'></script>
|
||||
<script src='../js/id/actions/start_way.js'></script>
|
||||
@@ -82,8 +83,9 @@
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script src="spec/actions/add_way_node.js"></script>
|
||||
<script src="spec/actions/delete_node.js"></script>
|
||||
<script src="spec/actions/delete_way.js"></script>
|
||||
<script src="spec/actions/remove_way_node.js"></script>
|
||||
<script src="spec/actions/remove.js"></script>
|
||||
<script src="spec/format/geojson.js"></script>
|
||||
<script src="spec/format/xml.js"></script>
|
||||
<script src="spec/graph/graph.js"></script>
|
||||
|
||||
@@ -26,8 +26,9 @@
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script src="spec/actions/add_way_node.js"></script>
|
||||
<script src="spec/actions/delete_node.js"></script>
|
||||
<script src="spec/actions/delete_way.js"></script>
|
||||
<script src="spec/actions/remove_way_node.js"></script>
|
||||
<script src="spec/actions/remove.js"></script>
|
||||
<script src="spec/format/geojson.js"></script>
|
||||
<script src="spec/format/xml.js"></script>
|
||||
<script src="spec/graph/graph.js"></script>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
describe("iD.actions.DeleteNode", function () {
|
||||
it("removes the node from the graph", function () {
|
||||
var node = iD.Node(),
|
||||
action = iD.actions.DeleteNode(node),
|
||||
graph = action(iD.Graph([node]));
|
||||
expect(graph.entity(node.id)).to.be.undefined;
|
||||
});
|
||||
|
||||
it("removes the node from parent ways", function () {
|
||||
var node = iD.Node(),
|
||||
way = iD.Way({nodes: [node.id]}),
|
||||
action = iD.actions.DeleteNode(node),
|
||||
graph = action(iD.Graph([node, way]));
|
||||
expect(graph.entity(way.id).nodes).not.to.contain(node.id);
|
||||
});
|
||||
|
||||
it("removes the node from parent relations", function () {
|
||||
var node = iD.Node(),
|
||||
relation = iD.Relation({members: [node.id]}),
|
||||
action = iD.actions.DeleteNode(node),
|
||||
graph = action(iD.Graph([node, relation]));
|
||||
expect(graph.entity(relation.id).members).not.to.contain(node.id);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
describe("iD.actions.DeleteWay", function () {
|
||||
it("removes the way from the graph", function () {
|
||||
var way = iD.Way(),
|
||||
action = iD.actions.DeleteWay(way),
|
||||
graph = action(iD.Graph([way]));
|
||||
expect(graph.entity(way.id)).to.be.undefined;
|
||||
});
|
||||
|
||||
it("removes a way from parent relations", function () {
|
||||
var way = iD.Way(),
|
||||
relation = iD.Relation({members: [way.id]}),
|
||||
action = iD.actions.DeleteWay(way),
|
||||
graph = action(iD.Graph([way, relation]));
|
||||
expect(graph.entity(relation.id).members).not.to.contain(way.id);
|
||||
});
|
||||
|
||||
it("deletes member nodes not referenced by another parent", function () {
|
||||
var node = iD.Node(),
|
||||
way = iD.Way({nodes: [node.id]}),
|
||||
action = iD.actions.DeleteWay(way),
|
||||
graph = action(iD.Graph([node, way]));
|
||||
expect(graph.entity(node.id)).to.be.undefined;
|
||||
});
|
||||
|
||||
it("does not delete member nodes referenced by another parent", function () {
|
||||
var node = iD.Node(),
|
||||
way1 = iD.Way({nodes: [node.id]}),
|
||||
way2 = iD.Way({nodes: [node.id]}),
|
||||
action = iD.actions.DeleteWay(way1),
|
||||
graph = action(iD.Graph([node, way1, way2]));
|
||||
expect(graph.entity(node.id)).not.to.be.undefined;
|
||||
});
|
||||
|
||||
it("does not delete member nodes with interesting tags");
|
||||
it("registers member nodes with interesting tags as POIs");
|
||||
});
|
||||
@@ -1,24 +0,0 @@
|
||||
describe("iD.actions.remove", function () {
|
||||
it("removes the entity from the graph", function () {
|
||||
var entity = iD.Way(),
|
||||
action = iD.actions.remove(entity),
|
||||
graph = action(iD.Graph().replace(entity));
|
||||
expect(graph.entity(entity.id)).to.be.undefined;
|
||||
});
|
||||
|
||||
it("removes a node from parent ways", function () {
|
||||
var node = iD.Node(),
|
||||
way = iD.Way().update({nodes: [node.id]}),
|
||||
action = iD.actions.remove(node),
|
||||
graph = action(iD.Graph().replace(node).replace(way));
|
||||
expect(graph.entity(way.id).nodes).not.to.contain(node.id);
|
||||
});
|
||||
|
||||
it("removes a way from parent relations", function () {
|
||||
var way = iD.Way(),
|
||||
relation = iD.Relation().update({members: [way.id]}),
|
||||
action = iD.actions.remove(way),
|
||||
graph = action(iD.Graph().replace(way).replace(relation));
|
||||
expect(graph.entity(relation.id).members).not.to.contain(way.id);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user