getFeatureAtPixel always returns array

This commit is contained in:
Simon Seyock
2019-09-24 17:16:25 +02:00
parent f21d698915
commit 82486899df
4 changed files with 14 additions and 10 deletions
+6 -4
View File
@@ -279,9 +279,10 @@ describe('ol.Map', function() {
document.body.removeChild(target);
});
it('returns null if no feature was found', function() {
it('returns an empty array if no feature was found', function() {
const features = map.getFeaturesAtPixel([0, 0]);
expect(features).to.be(null);
expect(features).to.be.an(Array);
expect(features).to.be.empty();
});
it('returns an array of found features', function() {
@@ -311,10 +312,11 @@ describe('ol.Map', function() {
map.addLayer(otherLayer);
const features = map.getFeaturesAtPixel([50, 50], {
layerFilter: function(layer) {
return layer == otherLayer;
return layer === otherLayer;
}
});
expect(features).to.be(null);
expect(features).to.be.an(Array);
expect(features).to.be.empty();
});
});
@@ -369,7 +369,8 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
const features = map.getFeaturesAtPixel([96, 96]);
document.body.removeChild(target);
map.dispose();
expect(features).to.be(null);
expect(features).to.be.an(Array);
expect(features).to.be.empty();
done();
}, 200);
});