For ice rinks, prefer the "sport" values "ice_hockey" and "ice_skating" instead of "hockey" and "skating" since that latter are ambiguous

Don't remove other values when upgrading a tag value within a semicolon-delimited list
This commit is contained in:
Quincy Morgan
2019-05-23 15:39:15 -04:00
parent 642e651f5d
commit 0dfd0612b1
5 changed files with 44 additions and 6 deletions
+18 -2
View File
@@ -24,6 +24,14 @@ describe('iD.actionUpgradeTags', function () {
expect(graph.entity(entity.id).tags).to.eql({ natural: 'wetland', wetland: 'marsh', name: 'Foo' });
});
it('upgrades a tag and overrides an existing value', function () {
var oldTags = { landuse: 'wood' },
newTags = { natural: 'wood' },
entity = iD.Entity({ tags: { landuse: 'wood', natural: 'wetland', name: 'Foo' }}),
graph = iD.actionUpgradeTags(entity.id, oldTags, newTags)(iD.coreGraph([entity]));
expect(graph.entity(entity.id).tags).to.eql({ natural: 'wood', name: 'Foo' });
});
it('upgrades a tag with no replacement tags', function () {
var oldTags = { highway: 'no' },
newTags = undefined,
@@ -56,7 +64,7 @@ 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 () {
it('upgrades a tag from a semicolon-delimited list that has one other value', function () {
var oldTags = { cuisine: 'vegan' },
newTags = { 'diet:vegan': 'yes' },
entity = iD.Entity({ tags: { cuisine: 'italian;vegan', name: 'Foo' }}),
@@ -64,7 +72,7 @@ describe('iD.actionUpgradeTags', function () {
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 () {
it('upgrades a tag from a semicolon-delimited list that has many other values', function () {
var oldTags = { cuisine: 'vegan' },
newTags = { 'diet:vegan': 'yes' },
entity = iD.Entity({ tags: { cuisine: 'italian;vegan;regional;american', name: 'Foo' }}),
@@ -72,4 +80,12 @@ describe('iD.actionUpgradeTags', function () {
expect(graph.entity(entity.id).tags).to.eql({ cuisine: 'italian;regional;american', 'diet:vegan': 'yes', name: 'Foo' });
});
it('upgrades a tag within a semicolon-delimited list without changing other values', function () {
var oldTags = { leisure: 'ice_rink', sport: 'hockey' },
newTags = { leisure: 'ice_rink', sport: 'ice_hockey' },
entity = iD.Entity({ tags: { leisure: 'ice_rink', sport: 'curling;hockey;multi', name: 'Foo' }}),
graph = iD.actionUpgradeTags(entity.id, oldTags, newTags)(iD.coreGraph([entity]));
expect(graph.entity(entity.id).tags).to.eql({ leisure: 'ice_rink', sport: 'curling;ice_hockey;multi', name: 'Foo' });
});
});