mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-17 22:24:49 +02:00
Exclude from areaKeys blacklist presets that are point/vertex only
(closes #3009)
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ iD.presets = function() {
|
||||
if (ignore.indexOf(key) !== -1) return;
|
||||
|
||||
var value = d.tags[key];
|
||||
if (d.geometry.indexOf('area') === -1 && key in areaKeys && value !== '*') {
|
||||
if (d.geometry.indexOf('line') !== -1 && key in areaKeys && value !== '*') {
|
||||
areaKeys[key][value] = true;
|
||||
}
|
||||
});
|
||||
|
||||
+44
-13
@@ -43,28 +43,59 @@ describe("iD.presets", function() {
|
||||
describe("#areaKeys", function() {
|
||||
var presets = iD.presets().load({
|
||||
presets: {
|
||||
a: {
|
||||
tags: {
|
||||
a: '*'
|
||||
},
|
||||
geometry: ['point', 'line', 'area']
|
||||
'amenity/fuel/shell': {
|
||||
tags: { 'amenity': 'fuel' },
|
||||
geometry: ['point','area'],
|
||||
suggestion: true
|
||||
},
|
||||
ab: {
|
||||
tags: {
|
||||
a: 'b'
|
||||
},
|
||||
'highway/foo': {
|
||||
tags: { 'highway': 'foo' },
|
||||
geometry: ['area']
|
||||
},
|
||||
'natural': {
|
||||
tags: { 'natural': '*' },
|
||||
geometry: ['point', 'vertex', 'area']
|
||||
},
|
||||
'natural/peak': {
|
||||
tags: { 'natural': 'peak' },
|
||||
geometry: ['point', 'vertex']
|
||||
},
|
||||
'natural/tree_row': {
|
||||
tags: { 'natural': 'tree_row' },
|
||||
geometry: ['line']
|
||||
}
|
||||
'natural/wood': {
|
||||
tags: { 'natural': 'wood' },
|
||||
geometry: ['point', 'area']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("whitelists keys from presets with area geometry", function() {
|
||||
expect(presets.areaKeys()).to.have.key('a');
|
||||
it("whitelists keys for presets with area geometry", function() {
|
||||
expect(presets.areaKeys()).to.have.key('natural');
|
||||
});
|
||||
|
||||
it("blacklists key-values from presets without an area geometry", function() {
|
||||
expect(presets.areaKeys().a.b).to.eq(true);
|
||||
it("blacklists key-values for presets with a line geometry", function() {
|
||||
expect(presets.areaKeys().natural).to.have.key('tree_row');
|
||||
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() {
|
||||
expect(presets.areaKeys().natural).not.to.have.key('peak');
|
||||
});
|
||||
|
||||
it("does not blacklist generic '*' key-values", function() {
|
||||
expect(presets.areaKeys().natural).not.to.have.key('natural');
|
||||
});
|
||||
|
||||
it("ignores keys like 'highway'", function() {
|
||||
expect(presets.areaKeys()).not.to.have.key('highway');
|
||||
});
|
||||
|
||||
it("ignores suggestion presets", function() {
|
||||
expect(presets.areaKeys()).not.to.have.key('amenity');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("expected matches", function() {
|
||||
|
||||
Reference in New Issue
Block a user