Merge pull request #12789 from ahocevar/mapbox-vector-layer-tilejson

Handle TileJSON urls in Mapbox Style document
This commit is contained in:
Andreas Hocevar
2021-09-21 11:08:51 +00:00
committed by GitHub
4 changed files with 63 additions and 19 deletions

View File

@@ -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();
});
});
});
});