Optionally include ids members of modified relations in extantIDs

(closes #6273)
This commit is contained in:
Bryan Housel
2019-05-08 13:52:43 -04:00
parent 7e36ed0d93
commit 86c6805cf7
3 changed files with 57 additions and 7 deletions
+30
View File
@@ -118,6 +118,36 @@ describe('iD.coreDifference', function () {
var diff = iD.coreDifference(base, head);
expect(diff.extantIDs()).to.eql([]);
});
it('omits the ids of members of modified relations by default', function () {
var w1 = iD.osmWay({id: 'w1'});
var w2 = iD.osmWay({id: 'w2'});
var r1 = iD.osmRelation({
id: 'r',
tags: { type: 'multipolygon' },
members: [{role: 'outer', id: 'w1', type: 'way'}, {role: '', id: 'w2', type: 'way'}]
});
var r2 = r1.update({ tags: { type: 'multipolygon', landuse: 'residential' }});
var base = iD.coreGraph([r1, w1, w2]);
var head = base.replace(r2);
var diff = iD.coreDifference(base, head);
expect(diff.extantIDs()).to.eql(['r']);
});
it('includes the ids of members of modified relations with option', function () {
var w1 = iD.osmWay({id: 'w1'});
var w2 = iD.osmWay({id: 'w2'});
var r1 = iD.osmRelation({
id: 'r',
tags: { type: 'multipolygon' },
members: [{role: 'outer', id: 'w1', type: 'way'}, {role: '', id: 'w2', type: 'way'}]
});
var r2 = r1.update({ tags: { type: 'multipolygon', landuse: 'residential' }});
var base = iD.coreGraph([r1, w1, w2]);
var head = base.replace(r2);
var diff = iD.coreDifference(base, head);
expect(diff.extantIDs(true)).to.eql(['r', 'w1', 'w2']);
});
});
describe('#created', function () {