diff --git a/modules/presets/index.js b/modules/presets/index.js index 835808ef3..8af3f943f 100644 --- a/modules/presets/index.js +++ b/modules/presets/index.js @@ -23,18 +23,17 @@ export function presetIndex(context) { let _presetData; // seed the preset lists with geometry fallbacks - const POINT = presetPreset('point', { name: 'Point', tags: {}, geometry: ['point'], matchScore: 0.1 } ); - const VERTEX = presetPreset('vertex', { name: 'Point', tags: {}, geometry: ['vertex'], matchScore: 0.1 } ); + const POINT = presetPreset('point', { name: 'Point', tags: {}, geometry: ['point', 'vertex'], matchScore: 0.1 } ); const LINE = presetPreset('line', { name: 'Line', tags: {}, geometry: ['line'], matchScore: 0.1 } ); const AREA = presetPreset('area', { name: 'Area', tags: { area: 'yes' }, geometry: ['area'], matchScore: 0.1 } ); const RELATION = presetPreset('relation', { name: 'Relation', tags: {}, geometry: ['relation'], matchScore: 0.1 } ); - let _this = presetCollection([POINT, VERTEX, LINE, AREA, RELATION]); - let _presets = { point: POINT, vertex: VERTEX, line: LINE, area: AREA, relation: RELATION }; + let _this = presetCollection([POINT, LINE, AREA, RELATION]); + let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION }; let _defaults = { point: presetCollection([POINT]), - vertex: presetCollection([VERTEX]), + vertex: presetCollection([POINT]), line: presetCollection([LINE]), area: presetCollection([AREA]), relation: presetCollection([RELATION]) diff --git a/test/spec/presets/index.js b/test/spec/presets/index.js index 48bc5a8a0..eb051c642 100644 --- a/test/spec/presets/index.js +++ b/test/spec/presets/index.js @@ -12,6 +12,36 @@ describe('iD.presetIndex', function () { }); + describe('#init', function () { + it('has a fallback point preset', function () { + var node = iD.osmNode({ id: 'n' }); + var graph = iD.coreGraph([node]); + var presets = iD.coreContext().init().presets(); + expect(presets.match(node, graph).id).to.eql('point'); + }); + it('has a fallback line preset', function () { + var node = iD.osmNode({ id: 'n' }); + var way = iD.osmWay({ id: 'w', nodes: ['n'] }); + var graph = iD.coreGraph([node, way]); + var presets = iD.coreContext().init().presets(); + expect(presets.match(way, graph).id).to.eql('line'); + }); + it('has a fallback area preset', function () { + var node = iD.osmNode({ id: 'n' }); + var way = iD.osmWay({ id: 'w', nodes: ['n'], tags: { area: 'yes' }}); + var graph = iD.coreGraph([node, way]); + var presets = iD.coreContext().init().presets(); + expect(presets.match(way, graph).id).to.eql('area'); + }); + it('has a fallback relation preset', function () { + var relation = iD.osmRelation({ id: 'r' }); + var graph = iD.coreGraph([relation]); + var presets = iD.coreContext().init().presets(); + expect(presets.match(relation, graph).id).to.eql('relation'); + }); + }); + + describe('#match', function () { var testPresets = { residential: { tags: { highway: 'residential' }, geometry: ['line'] },