Adjust tree for force-rebased entities

Previously, entities that already existed in the rtree prior to the rebase
option would end up duplicated in the tree afterward.

Fixes #2637
This commit is contained in:
John Firebaugh
2015-05-09 14:38:41 -07:00
parent 1a3e2c0ebf
commit f8a68c879f
2 changed files with 24 additions and 1 deletions
+15
View File
@@ -56,6 +56,21 @@ describe("iD.Tree", function() {
expect(tree.intersects(iD.geo.Extent([0, 0], [2, 2]), graph)).to.eql([relation]);
});
it("adjusts entities that are force-rebased", function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({id: 'n', loc: [1, 1]});
graph.rebase([node], [graph]);
tree.rebase([node]);
node = node.move([-1, -1]);
graph.rebase([node], [graph], true);
tree.rebase([node], true);
expect(tree.intersects(iD.geo.Extent([0, 0], [2, 2]), graph)).to.eql([]);
});
});
describe("#intersects", function() {