Immediately load OSM place when selecting a map feature
No waiting for Overpass when selecting visible POIs anymore
This commit is contained in:
2 files changed
+170
No files matched your search
@@ -0,0 +1,60 @@
|
||||
import MapComponent from 'marco/components/map';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
module('Unit | Component | map', function () {
|
||||
test('it decodes Planetiler vector tile POI ids into OSM ids and types', function (assert) {
|
||||
const feature = {
|
||||
get(key) {
|
||||
if (key === 'mvt:layer') return 'poi';
|
||||
return undefined;
|
||||
},
|
||||
getId() {
|
||||
return 12342;
|
||||
},
|
||||
};
|
||||
|
||||
const result = MapComponent.prototype.decodeVectorTileOsmFeature(feature);
|
||||
|
||||
assert.deepEqual(result, {
|
||||
decoded: {
|
||||
osmId: '1234',
|
||||
osmType: 'way',
|
||||
},
|
||||
reason: null,
|
||||
});
|
||||
});
|
||||
|
||||
test('it ignores non-POI vector tile features', function (assert) {
|
||||
const feature = {
|
||||
get(key) {
|
||||
if (key === 'mvt:layer') return 'transportation';
|
||||
return undefined;
|
||||
},
|
||||
getId() {
|
||||
return 12342;
|
||||
},
|
||||
};
|
||||
|
||||
assert.deepEqual(MapComponent.prototype.decodeVectorTileOsmFeature(feature), {
|
||||
decoded: null,
|
||||
reason: 'unsupported source layer: transportation',
|
||||
});
|
||||
});
|
||||
|
||||
test('it ignores unsupported or invalid vector tile ids', function (assert) {
|
||||
const feature = {
|
||||
get(key) {
|
||||
if (key === 'mvt:layer') return 'poi';
|
||||
return undefined;
|
||||
},
|
||||
getId() {
|
||||
return 12340;
|
||||
},
|
||||
};
|
||||
|
||||
assert.deepEqual(MapComponent.prototype.decodeVectorTileOsmFeature(feature), {
|
||||
decoded: null,
|
||||
reason: 'feature id suffix 0 is not an OSM type',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user