Added FEATURELOADSTART, FEATURELOADEND and FEATURELOADERROR events.

This commit is contained in:
Simon Seyock
2020-10-06 12:16:15 +02:00
parent 393e83cd29
commit 1bafab49f5
5 changed files with 165 additions and 12 deletions

View File

@@ -19,8 +19,10 @@ describe('ol.featureloader', function () {
it('adds features to the source', function (done) {
loader = xhr(url, format);
source.on('addfeature', function (e) {
expect(source.getFeatures().length).to.be.greaterThan(0);
done();
setTimeout(function () {
expect(source.getFeatures().length).to.be.greaterThan(0);
done();
}, 0);
});
loader.call(source, [], 1, 'EPSG:3857');
});
@@ -33,8 +35,10 @@ describe('ol.featureloader', function () {
loader = xhr(url, format);
source.on('addfeature', function (e) {
expect(source.getFeatures().length).to.be.greaterThan(0);
done();
setTimeout(function () {
expect(source.getFeatures().length).to.be.greaterThan(0);
done();
}, 0);
});
loader.call(source, [], 1, 'EPSG:3857');
});
@@ -54,5 +58,23 @@ describe('ol.featureloader', function () {
loader.call(source, [], 1, 'EPSG:3857');
});
});
it('it calls the success callback', function (done) {
const errorSpy = sinon.spy();
loader = xhr(url, format);
loader.call(
source,
[],
1,
'EPSG:3857',
function () {
setTimeout(function () {
expect(errorSpy.callCount).to.be(0);
done();
}, 0);
},
errorSpy
);
});
});
});