From fafb9f3d41e54f9bc58cc3a4b4d820a0de77eba9 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Fri, 26 Jul 2024 11:59:06 +0200 Subject: [PATCH] add test case for #10342 --- test/spec/core/tree.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/spec/core/tree.js b/test/spec/core/tree.js index 970bba212..ef8e5be84 100644 --- a/test/spec/core/tree.js +++ b/test/spec/core/tree.js @@ -146,6 +146,21 @@ describe('iD.coreTree', function() { expect(tree.intersects(extent, graph)).to.eql([]); }); + it('adjusts all parent relations when a member node is moved', function() { + var graph = iD.coreGraph(), + tree = iD.coreTree(graph), + node = iD.osmNode({id: 'n', loc: [1, 1]}), + relation1 = iD.osmRelation({members: [{type: 'node', id: 'n'}]}), + relation2 = iD.osmRelation({members: [{type: 'node', id: 'n'}]}), + extent = iD.geoExtent([0, 0], [2, 2]); + + graph = graph.replace(node).replace(relation1).replace(relation2); + expect(tree.intersects(extent, graph)).to.eql([node, relation1, relation2]); + + graph = graph.replace(node.move([3, 3])); + expect(tree.intersects(extent, graph)).to.eql([]); + }); + it('adjusts parent relations of parent ways when a member node is moved', function() { var graph = iD.coreGraph(), tree = iD.coreTree(graph),