Handle TileJSON urls in Mapbox Style document

This commit is contained in:
Andreas Hocevar
2021-09-20 22:43:27 +00:00
parent e5193ffa6e
commit 8585d4382b
4 changed files with 63 additions and 19 deletions
@@ -1,4 +1,4 @@
import {
import MapboxVectorLayer, {
getMapboxPath,
normalizeSourceUrl,
normalizeSpriteUrl,
@@ -91,4 +91,29 @@ describe('ol/layer/MapboxVector', () => {
});
}
});
describe('TileJSON', function () {
it('lets ol-mapbox-style handle TileJSON URLs', function (done) {
const layer = new MapboxVectorLayer({
styleUrl:
'data:,' +
encodeURIComponent(
JSON.stringify({
version: 8,
sources: {
'foo': {
url: '/spec/ol/data/tilejson.json',
type: 'vector',
},
},
})
),
});
layer.on('change:source', function () {
// we only get here when a new source was set, which is what ol-mapbox-style's
// setupVectorSource() does.
done();
});
});
});
});