mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-26 18:07:50 +02:00
@@ -1,33 +1,33 @@
|
||||
describe('iD.actionDiscardTags', function() {
|
||||
it('discards obsolete tags from modified entities', function() {
|
||||
var way = iD.Way({id: 'w1', tags: {created_by: 'Potlatch'}}),
|
||||
base = iD.Graph([way]),
|
||||
head = base.replace(way.update({tags: {created_by: 'Potlatch', foo: 'bar'}})),
|
||||
action = iD.actionDiscardTags(iD.Difference(base, head));
|
||||
var way = iD.osmWay({ id: 'w1', tags: { created_by: 'Potlatch' } });
|
||||
var base = iD.coreGraph([way]);
|
||||
var head = base.replace(way.update({ tags: { created_by: 'Potlatch', foo: 'bar' } }));
|
||||
var action = iD.actionDiscardTags(iD.coreDifference(base, head));
|
||||
expect(action(head).entity(way.id).tags).to.eql({foo: 'bar'});
|
||||
});
|
||||
|
||||
it('discards obsolete tags from created entities', function() {
|
||||
var way = iD.Way({tags: {created_by: 'Potlatch'}}),
|
||||
base = iD.Graph(),
|
||||
head = base.replace(way),
|
||||
action = iD.actionDiscardTags(iD.Difference(base, head));
|
||||
var way = iD.osmWay({ tags: { created_by: 'Potlatch' } });
|
||||
var base = iD.coreGraph();
|
||||
var head = base.replace(way);
|
||||
var action = iD.actionDiscardTags(iD.coreDifference(base, head));
|
||||
expect(action(head).entity(way.id).tags).to.eql({});
|
||||
});
|
||||
|
||||
it('doesn\'t modify entities without obsolete tags', function() {
|
||||
var way = iD.Way(),
|
||||
base = iD.Graph(),
|
||||
head = base.replace(way),
|
||||
action = iD.actionDiscardTags(iD.Difference(base, head));
|
||||
var way = iD.osmWay();
|
||||
var base = iD.coreGraph();
|
||||
var head = base.replace(way);
|
||||
var action = iD.actionDiscardTags(iD.coreDifference(base, head));
|
||||
expect(action(head).entity(way.id)).to.equal(way);
|
||||
});
|
||||
|
||||
it('discards tags with empty values', function() {
|
||||
var way = iD.Way({tags: {lmnop: ''}}),
|
||||
base = iD.Graph(),
|
||||
head = base.replace(way),
|
||||
action = iD.actionDiscardTags(iD.Difference(base, head));
|
||||
var way = iD.osmWay({ tags: { lmnop: '' } });
|
||||
var base = iD.coreGraph();
|
||||
var head = base.replace(way);
|
||||
var action = iD.actionDiscardTags(iD.coreDifference(base, head));
|
||||
expect(action(head).entity(way.id).tags).to.eql({});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user