Pass null as forEachFeatureAtPixel layer arg for unmanaged layers

This commit is contained in:
Andreas Hocevar
2015-11-06 21:31:25 +01:00
parent 5b817f3146
commit 1aea2c2b0c
5 changed files with 24 additions and 4 deletions

View File

@@ -46,13 +46,23 @@ describe('ol.renderer.canvas.Map', function() {
document.body.removeChild(target);
});
it('always includes unmanaged layers', function() {
it('calls callback with layer for managed layers', function() {
map.addLayer(layer);
map.renderSync();
var cb = sinon.spy();
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]), cb);
expect(cb).to.be.called();
expect(cb.firstCall.args[1]).to.be(layer);
});
it('includes unmanaged layers, but calls callback with null', function() {
layer.setMap(map);
map.renderSync();
var cb = sinon.spy();
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]), cb, null,
function() { return false; });
expect(cb).to.be.called();
expect(cb.firstCall.args[1]).to.be(null);
});
it('filters managed layers', function() {