Don't add addr:housenumber=yes when applying Address preset (#1874)

This commit is contained in:
John Firebaugh
2013-10-09 16:35:12 -07:00
parent 20d3af5620
commit d1b4e04ee4
4 changed files with 8 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
"tags": {
"addr:housenumber": "*"
},
"addTags": {},
"matchScore": 0.2,
"name": "Address"
},

View File

@@ -8,6 +8,7 @@
"tags": {
"addr:housenumber": "*"
},
"addTags": {},
"matchScore": 0.2,
"name": "Address"
}

View File

@@ -73,7 +73,7 @@ iD.presets.Preset = function(id, preset, fields) {
return tags;
};
var applyTags = preset.applyTags || preset.tags;
var applyTags = preset.addTags || preset.tags;
preset.applyTags = function(tags, geometry) {
tags = _.clone(tags);

View File

@@ -69,6 +69,11 @@ describe('iD.presets.Preset', function() {
expect(preset.applyTags({}, 'area')).to.eql({building: 'yes'});
});
it("prefers to add tags of addTags property", function() {
var preset = iD.presets.Preset('test', {tags: {building: '*'}, addTags: {building: 'ok'}});
expect(preset.applyTags({}, 'area')).to.eql({building: 'ok'});
});
it("adds default tags of fields with matching geometry", function() {
var field = iD.presets.Field('field', {key: 'building', geometry: 'area', default: 'yes'}),
preset = iD.presets.Preset('test', {fields: ['field']}, {field: field});