Merge pull request #12141 from kikitte/main
call the success callback after the features are added
This commit is contained in:
@@ -156,10 +156,10 @@ export function xhr(url, format) {
|
|||||||
* projection.
|
* projection.
|
||||||
*/
|
*/
|
||||||
function (features, dataProjection) {
|
function (features, dataProjection) {
|
||||||
|
source.addFeatures(features);
|
||||||
if (success !== undefined) {
|
if (success !== undefined) {
|
||||||
success(features);
|
success(features);
|
||||||
}
|
}
|
||||||
source.addFeatures(features);
|
|
||||||
},
|
},
|
||||||
/* FIXME handle error */ failure ? failure : VOID
|
/* FIXME handle error */ failure ? failure : VOID
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -571,6 +571,24 @@ describe('ol.source.Vector', function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('fires the FEATURESLOADEND event after the features are added', function (done) {
|
||||||
|
const source = new VectorSource({
|
||||||
|
format: new GeoJSON(),
|
||||||
|
url: 'spec/ol/source/vectorsource/single-feature.json',
|
||||||
|
});
|
||||||
|
source.on('featuresloadend', function () {
|
||||||
|
const features = source.getFeatures();
|
||||||
|
expect(features).to.be.an('array');
|
||||||
|
expect(features.length).to.be(1);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
source.loadFeatures(
|
||||||
|
[-10000, -10000, 10000, 10000],
|
||||||
|
1,
|
||||||
|
getProjection('EPSG:3857')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('fires the FEATURESLOADEND event if the default load function is used', function (done) {
|
it('fires the FEATURESLOADEND event if the default load function is used', function (done) {
|
||||||
const source = new VectorSource({
|
const source = new VectorSource({
|
||||||
format: new GeoJSON(),
|
format: new GeoJSON(),
|
||||||
|
|||||||
Reference in New Issue
Block a user