mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 07:25:15 +02:00
Merge branch 'master' of git://github.com/systemed/iD into rotate2
Conflicts: index.html test/index.html
This commit is contained in:
+3
-3
@@ -26,7 +26,6 @@
|
||||
<script src='../js/lib/d3.trigger.js'></script>
|
||||
<script src='../js/lib/d3.typeahead.js'></script>
|
||||
<script src='../js/lib/d3.one.js'></script>
|
||||
<script src='../js/lib/d3.tail.js'></script>
|
||||
<script src='../js/lib/ohauth.js'></script>
|
||||
<script src='../js/lib/jxon.js'></script>
|
||||
<script src="../js/lib/rtree.js"></script>
|
||||
@@ -78,6 +77,7 @@
|
||||
<script src='../js/id/ui/source_switch.js'></script>
|
||||
<script src='../js/id/ui/tageditor.js'></script>
|
||||
<script src='../js/id/ui/taglist.js'></script>
|
||||
<script src='../js/id/ui/tail.js'></script>
|
||||
<script src='../js/id/ui/toggle.js'></script>
|
||||
|
||||
<script src='../js/id/actions.js'></script>
|
||||
@@ -96,7 +96,7 @@
|
||||
<script src='../js/id/actions/join.js'></script>
|
||||
<script src='../js/id/actions/merge.js'></script>
|
||||
<script src='../js/id/actions/move_node.js'></script>
|
||||
<script src='../js/id/actions/move_way.js'></script>
|
||||
<script src='../js/id/actions/move.js'></script>
|
||||
<script src='../js/id/actions/rotate_way.js'></script>
|
||||
<script src='../js/id/actions/noop.js'></script>
|
||||
<script src='../js/id/actions/reverse.js'></script>
|
||||
@@ -180,7 +180,7 @@
|
||||
<script src="spec/actions/join.js"></script>
|
||||
<script src='spec/actions/merge.js'></script>
|
||||
<script src="spec/actions/move_node.js"></script>
|
||||
<script src="spec/actions/move_way.js"></script>
|
||||
<script src="spec/actions/move.js"></script>
|
||||
<script src="spec/actions/noop.js"></script>
|
||||
<script src="spec/actions/reverse.js"></script>
|
||||
<script src="spec/actions/split.js"></script>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<script src="spec/actions/join.js"></script>
|
||||
<script src='spec/actions/merge.js'></script>
|
||||
<script src="spec/actions/move_node.js"></script>
|
||||
<script src="spec/actions/move_way.js"></script>
|
||||
<script src="spec/actions/move.js"></script>
|
||||
<script src="spec/actions/noop.js"></script>
|
||||
<script src="spec/actions/reverse.js"></script>
|
||||
<script src="spec/actions/split.js"></script>
|
||||
|
||||
@@ -14,4 +14,63 @@ describe("iD.actions.DeleteRelation", function () {
|
||||
graph = action(iD.Graph([a, b, parent]));
|
||||
expect(graph.entity(parent.id).members).to.eql([{ id: b.id }]);
|
||||
});
|
||||
|
||||
it("deletes member nodes not referenced by another parent", function() {
|
||||
var node = iD.Node(),
|
||||
relation = iD.Relation({members: [{id: node.id}]}),
|
||||
action = iD.actions.DeleteRelation(relation.id),
|
||||
graph = action(iD.Graph([node, relation]));
|
||||
expect(graph.entity(node.id)).to.be.undefined;
|
||||
});
|
||||
|
||||
it("does not delete member nodes referenced by another parent", function() {
|
||||
var node = iD.Node(),
|
||||
way = iD.Way({nodes: [node.id]}),
|
||||
relation = iD.Relation({members: [{id: node.id}]}),
|
||||
action = iD.actions.DeleteRelation(relation.id),
|
||||
graph = action(iD.Graph([node, way, relation]));
|
||||
expect(graph.entity(node.id)).not.to.be.undefined;
|
||||
});
|
||||
|
||||
it("does not delete member nodes with interesting tags", function() {
|
||||
var node = iD.Node({tags: {highway: 'traffic_signals'}}),
|
||||
relation = iD.Relation({members: [{id: node.id}]}),
|
||||
action = iD.actions.DeleteRelation(relation.id),
|
||||
graph = action(iD.Graph([node, relation]));
|
||||
expect(graph.entity(node.id)).not.to.be.undefined;
|
||||
});
|
||||
|
||||
it("deletes member ways not referenced by another parent", function() {
|
||||
var way = iD.Way(),
|
||||
relation = iD.Relation({members: [{id: way.id}]}),
|
||||
action = iD.actions.DeleteRelation(relation.id),
|
||||
graph = action(iD.Graph([way, relation]));
|
||||
expect(graph.entity(way.id)).to.be.undefined;
|
||||
});
|
||||
|
||||
it("does not delete member ways referenced by another parent", function() {
|
||||
var way = iD.Way(),
|
||||
relation1 = iD.Relation({members: [{id: way.id}]}),
|
||||
relation2 = iD.Relation({members: [{id: way.id}]}),
|
||||
action = iD.actions.DeleteRelation(relation1.id),
|
||||
graph = action(iD.Graph([way, relation1, relation2]));
|
||||
expect(graph.entity(way.id)).not.to.be.undefined;
|
||||
});
|
||||
|
||||
it("does not delete member ways with interesting tags", function() {
|
||||
var way = iD.Node({tags: {highway: 'residential'}}),
|
||||
relation = iD.Relation({members: [{id: way.id}]}),
|
||||
action = iD.actions.DeleteRelation(relation.id),
|
||||
graph = action(iD.Graph([way, relation]));
|
||||
expect(graph.entity(way.id)).not.to.be.undefined;
|
||||
});
|
||||
|
||||
it("deletes nodes of deleted member ways", function() {
|
||||
var node = iD.Node(),
|
||||
way = iD.Way({nodes: [node.id]}),
|
||||
relation = iD.Relation({members: [{id: way.id}]}),
|
||||
action = iD.actions.DeleteRelation(relation.id),
|
||||
graph = action(iD.Graph([node, way, relation]));
|
||||
expect(graph.entity(node.id)).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ describe("iD.actions.DeleteWay", function() {
|
||||
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);
|
||||
graph = iD.Graph([a, b, c, 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;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
describe("iD.actions.Move", function() {
|
||||
it("moves all nodes in a way by the given amount", function() {
|
||||
var node1 = iD.Node({loc: [0, 0]}),
|
||||
node2 = iD.Node({loc: [5, 10]}),
|
||||
way = iD.Way({nodes: [node1.id, node2.id]}),
|
||||
delta = [2, 3],
|
||||
projection = d3.geo.mercator(),
|
||||
graph = iD.actions.Move([way.id], delta, projection)(iD.Graph([node1, node2, way])),
|
||||
loc1 = graph.entity(node1.id).loc,
|
||||
loc2 = graph.entity(node2.id).loc;
|
||||
expect(loc1[0]).to.be.closeTo( 1.440, 0.001);
|
||||
expect(loc1[1]).to.be.closeTo(-2.159, 0.001);
|
||||
expect(loc2[0]).to.be.closeTo( 6.440, 0.001);
|
||||
expect(loc2[1]).to.be.closeTo( 7.866, 0.001);
|
||||
});
|
||||
|
||||
it("moves repeated nodes only once", function() {
|
||||
var node = iD.Node({loc: [0, 0]}),
|
||||
way = iD.Way({nodes: [node.id, node.id]}),
|
||||
delta = [2, 3],
|
||||
projection = d3.geo.mercator(),
|
||||
graph = iD.actions.Move([way.id], delta, projection)(iD.Graph([node, way])),
|
||||
loc = graph.entity(node.id).loc;
|
||||
expect(loc[0]).to.be.closeTo( 1.440, 0.001);
|
||||
expect(loc[1]).to.be.closeTo(-2.159, 0.001);
|
||||
});
|
||||
|
||||
it("moves multiple ways", function() {
|
||||
var node = iD.Node({loc: [0, 0]}),
|
||||
way1 = iD.Way({nodes: [node.id]}),
|
||||
way2 = iD.Way({nodes: [node.id]}),
|
||||
delta = [2, 3],
|
||||
projection = d3.geo.mercator(),
|
||||
graph = iD.actions.Move([way1.id, way2.id], delta, projection)(iD.Graph([node, way1, way2])),
|
||||
loc = graph.entity(node.id).loc;
|
||||
expect(loc[0]).to.be.closeTo( 1.440, 0.001);
|
||||
expect(loc[1]).to.be.closeTo(-2.159, 0.001);
|
||||
});
|
||||
|
||||
it("moves leaf nodes of a relation", function() {
|
||||
var node = iD.Node({loc: [0, 0]}),
|
||||
way = iD.Way({nodes: [node.id]}),
|
||||
relation = iD.Relation({members: [{id: way.id}]}),
|
||||
delta = [2, 3],
|
||||
projection = d3.geo.mercator(),
|
||||
graph = iD.actions.Move([relation.id], delta, projection)(iD.Graph([node, way, relation])),
|
||||
loc = graph.entity(node.id).loc;
|
||||
expect(loc[0]).to.be.closeTo( 1.440, 0.001);
|
||||
expect(loc[1]).to.be.closeTo(-2.159, 0.001);
|
||||
});
|
||||
});
|
||||
@@ -1,27 +0,0 @@
|
||||
describe("iD.actions.MoveWay", function() {
|
||||
it("moves all nodes in a way by the given amount", function() {
|
||||
var node1 = iD.Node({loc: [0, 0]}),
|
||||
node2 = iD.Node({loc: [5, 10]}),
|
||||
way = iD.Way({nodes: [node1.id, node2.id]}),
|
||||
delta = [2, 3],
|
||||
projection = d3.geo.mercator(),
|
||||
graph = iD.actions.MoveWay(way.id, delta, projection)(iD.Graph([node1, node2, way])),
|
||||
loc1 = graph.entity(node1.id).loc,
|
||||
loc2 = graph.entity(node2.id).loc;
|
||||
expect(loc1[0]).to.be.closeTo( 1.440, 0.001);
|
||||
expect(loc1[1]).to.be.closeTo(-2.159, 0.001);
|
||||
expect(loc2[0]).to.be.closeTo( 6.440, 0.001);
|
||||
expect(loc2[1]).to.be.closeTo( 7.866, 0.001);
|
||||
});
|
||||
|
||||
it("moves repeated nodes only once", function() {
|
||||
var node = iD.Node({loc: [0, 0]}),
|
||||
way = iD.Way({nodes: [node.id, node.id]}),
|
||||
delta = [2, 3],
|
||||
projection = d3.geo.mercator(),
|
||||
graph = iD.actions.MoveWay(way.id, delta, projection)(iD.Graph([node, way])),
|
||||
loc = graph.entity(node.id).loc;
|
||||
expect(loc[0]).to.be.closeTo( 1.440, 0.001);
|
||||
expect(loc[1]).to.be.closeTo(-2.159, 0.001);
|
||||
});
|
||||
});
|
||||
@@ -25,7 +25,7 @@ describe("iD.taginfo", function() {
|
||||
server.respond();
|
||||
|
||||
expect(query(server.requests[0].url)).to.eql(
|
||||
{query: "amen", page: "1", rp: "6", sortname: "count_all", sortorder: "desc"});
|
||||
{query: "ame", page: "1", rp: "10", sortname: "count_all", sortorder: "desc"});
|
||||
expect(callback).to.have.been.calledWith(null, [{"value":"amenity"}]);
|
||||
});
|
||||
|
||||
@@ -49,11 +49,11 @@ describe("iD.taginfo", function() {
|
||||
|
||||
server.respondWith("GET", new RegExp("http://taginfo.openstreetmap.org/api/4/keys/all"),
|
||||
[200, { "Content-Type": "application/json" },
|
||||
'{"data":[{"count_all":5190337,"key":"amenity","count_all_fraction":1.0, "count_nodes_fraction":1.0},\
|
||||
{"count_all":1,"key":"amenityother","count_all_fraction":0.0, "count_nodes_fraction":1.0}]}']);
|
||||
'{"data":[{"count_all":5190337,"count_nodes":500000,"key":"amenity","count_all_fraction":1.0, "count_nodes_fraction":1.0},\
|
||||
{"count_all":1,"key":"amenityother","count_all_fraction":0.0, "count_nodes":100}]}']);
|
||||
server.respond();
|
||||
|
||||
expect(callback).to.have.been.calledWith(null, [{"value":"amenity"},{"value":"amenityother"}]);
|
||||
expect(callback).to.have.been.calledWith(null, [{"value":"amenity"}]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ describe("iD.ui.Inspector", function () {
|
||||
entity, graph, context;
|
||||
|
||||
function render() {
|
||||
inspector = iD.ui.Inspector().context(context);
|
||||
inspector = iD.ui.Inspector(context);
|
||||
element = d3.select('body')
|
||||
.append('div')
|
||||
.attr('id', 'inspector-wrap')
|
||||
|
||||
Reference in New Issue
Block a user