diff --git a/test/spec/actions/delete_way.js b/test/spec/actions/delete_way.js index 2436b9149..863b0fa2f 100644 --- a/test/spec/actions/delete_way.js +++ b/test/spec/actions/delete_way.js @@ -2,7 +2,7 @@ describe("iD.actions.DeleteWay", function () { it("removes the way from the graph", function () { var way = iD.Way(), action = iD.actions.DeleteWay(way.id), - graph = action(iD.Graph([way])); + graph = iD.Graph([way]).update(action); expect(graph.entity(way.id)).to.be.undefined; }); @@ -10,7 +10,7 @@ describe("iD.actions.DeleteWay", function () { var way = iD.Way(), relation = iD.Relation({members: [{ id: way.id }]}), action = iD.actions.DeleteWay(way.id), - graph = action(iD.Graph([way, relation])); + graph = iD.Graph([way, relation]).update(action); expect(_.pluck(graph.entity(relation.id).members, 'id')).not.to.contain(way.id); }); @@ -18,7 +18,7 @@ describe("iD.actions.DeleteWay", function () { var node = iD.Node(), way = iD.Way({nodes: [node.id]}), action = iD.actions.DeleteWay(way.id), - graph = action(iD.Graph([node, way])); + graph = iD.Graph([node, way]).update(action); expect(graph.entity(node.id)).to.be.undefined; }); @@ -27,15 +27,38 @@ describe("iD.actions.DeleteWay", function () { way1 = iD.Way({nodes: [node.id]}), way2 = iD.Way({nodes: [node.id]}), action = iD.actions.DeleteWay(way1.id), - graph = action(iD.Graph([node, way1, way2])); + graph = iD.Graph([node, way1, way2]).update(action); expect(graph.entity(node.id)).not.to.be.undefined; }); + // See #508 + xit("deletes multiple member nodes", function () { + var a = iD.Node(), + b = iD.Node(), + way = iD.Way({nodes: [a.id, b.id]}), + action = iD.actions.DeleteWay(way.id), + graph = iD.Graph([a, b, way]).update(action); + expect(graph.entity(a.id)).to.be.undefined; + expect(graph.entity(b.id)).to.be.undefined; + }); + + xit("deletes a circular way's start/end node", function () { + var a = iD.Node(), + b = iD.Node(), + c = iD.Node(), + way = iD.Way({nodes: [a.id, b.id, c.id, a.id]}), + action = iD.actions.DeleteWay(way.id), + graph = iD.Graph([a, b, way]).update(action); + expect(graph.entity(a.id)).to.be.undefined; + expect(graph.entity(b.id)).to.be.undefined; + expect(graph.entity(c.id)).to.be.undefined; + }); + it("does not delete member nodes with interesting tags", function () { var node = iD.Node({tags: {highway: 'traffic_signals'}}), way = iD.Way({nodes: [node.id]}), action = iD.actions.DeleteWay(way.id), - graph = action(iD.Graph([node, way])); + graph = iD.Graph([node, way]).update(action); expect(graph.entity(node.id)).not.to.be.undefined; }); });