Flag and upgrade deprecated tags in a semicolon-delimited tag value (close #6038)

This commit is contained in:
Quincy Morgan
2019-03-11 10:22:28 -04:00
parent d9dfa2ff46
commit 93df5d42d9
3 changed files with 32 additions and 2 deletions
+16
View File
@@ -56,4 +56,20 @@ describe('iD.actionUpgradeTags', function () {
expect(graph.entity(entity.id).tags).to.eql({ shop: 'supermarket', name: 'Foo' });
});
it('upgrades a tag in a semicolon-delimited list with one other value', function () {
var oldTags = { cuisine: 'vegan' },
newTags = { 'diet:vegan': 'yes' },
entity = iD.Entity({ tags: { cuisine: 'italian;vegan', name: 'Foo' }}),
graph = iD.actionUpgradeTags(entity.id, oldTags, newTags)(iD.coreGraph([entity]));
expect(graph.entity(entity.id).tags).to.eql({ cuisine: 'italian', 'diet:vegan': 'yes', name: 'Foo' });
});
it('upgrades a tag in a semicolon-delimited list with many other values', function () {
var oldTags = { cuisine: 'vegan' },
newTags = { 'diet:vegan': 'yes' },
entity = iD.Entity({ tags: { cuisine: 'italian;vegan;regional;american', name: 'Foo' }}),
graph = iD.actionUpgradeTags(entity.id, oldTags, newTags)(iD.coreGraph([entity]));
expect(graph.entity(entity.id).tags).to.eql({ cuisine: 'italian;regional;american', 'diet:vegan': 'yes', name: 'Foo' });
});
});