Don't blacklist key-values for presets with both area and line geometry

This commit is contained in:
Bryan Housel
2016-03-10 15:56:57 -05:00
parent 83b324b0bb
commit 309bfacf74
2 changed files with 13 additions and 3 deletions

View File

@@ -74,7 +74,9 @@ iD.presets = function() {
if (ignore.indexOf(key) !== -1) return;
var value = d.tags[key];
if (d.geometry.indexOf('line') !== -1 && key in areaKeys && value !== '*') {
if (d.geometry.indexOf('area') === -1 &&
d.geometry.indexOf('line') !== -1 &&
key in areaKeys && value !== '*') {
areaKeys[key][value] = true;
}
});

View File

@@ -48,6 +48,10 @@ describe("iD.presets", function() {
geometry: ['point','area'],
suggestion: true
},
'golf/water_hazard': {
tags: { 'golf': 'water_hazard' },
geometry: ['line','area']
},
'highway/foo': {
tags: { 'highway': 'foo' },
geometry: ['area']
@@ -80,7 +84,11 @@ describe("iD.presets", function() {
expect(presets.areaKeys().natural.tree_row).to.eq(true);
});
it("does not blacklist key-values for presets without a line geometry (e.g. used only on nodes)", function() {
it("does not blacklist key-values for presets with both area and line geometry", function() {
expect(presets.areaKeys().golf).not.to.have.key('water_hazard');
});
it("does not blacklist key-values for presets with neither area nor line geometry", function() {
expect(presets.areaKeys().natural).not.to.have.key('peak');
});
@@ -88,7 +96,7 @@ describe("iD.presets", function() {
expect(presets.areaKeys().natural).not.to.have.key('natural');
});
it("ignores keys like 'highway'", function() {
it("ignores keys like 'highway' that are assumed to be lines", function() {
expect(presets.areaKeys()).not.to.have.key('highway');
});