mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-28 19:01:31 +02:00
Fast parent calculation.
This commit is contained in:
@@ -69,18 +69,19 @@ describe('iD.Graph', function() {
|
||||
var node = iD.Node({id: "n1"}),
|
||||
way = iD.Way({id: "w1", nodes: ["n1"]}),
|
||||
graph = iD.Graph({n1: node, w1: way});
|
||||
expect(graph.parentWays("n1")).to.eql([way]);
|
||||
expect(graph.parentWays("n2")).to.eql([]);
|
||||
expect(graph.parentWays(node)).to.eql([way]);
|
||||
expect(graph.parentWays(way)).to.eql([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#parentRelations", function() {
|
||||
it("returns an array of relations that contain the given entity id", function () {
|
||||
var node = iD.Node({id: "n1"}),
|
||||
nonnode = iD.Node({id: "n2"}),
|
||||
relation = iD.Relation({id: "r1", members: [{ id: "n1", role: 'from' }]}),
|
||||
graph = iD.Graph({n1: node, r1: relation});
|
||||
expect(graph.parentRelations("n1")).to.eql([relation]);
|
||||
expect(graph.parentRelations("n2")).to.eql([]);
|
||||
expect(graph.parentRelations(node)).to.eql([relation]);
|
||||
expect(graph.parentRelations(nonnode)).to.eql([]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user