diff --git a/src/ol/interaction/selectinteraction.js b/src/ol/interaction/selectinteraction.js index e4c28fab07..77f559cc1e 100644 --- a/src/ol/interaction/selectinteraction.js +++ b/src/ol/interaction/selectinteraction.js @@ -283,7 +283,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) { * @param {ol.layer.Layer} layer Layer. */ function(feature, layer) { - if (layer && this.filter_(feature, layer)) { + if (!layer || this.filter_(feature, layer)) { selected.push(feature); this.addFeatureLayerAssociation_(feature, layer); return !this.multi_; diff --git a/test/spec/ol/interaction/selectinteraction.test.js b/test/spec/ol/interaction/selectinteraction.test.js index 89530aa4ff..c9e2c5a1e9 100644 --- a/test/spec/ol/interaction/selectinteraction.test.js +++ b/test/spec/ol/interaction/selectinteraction.test.js @@ -179,7 +179,7 @@ describe('ol.interaction.Select', function() { unmanaged.setMap(map); map.renderSync(); simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20); - expect(spy.firstCall.args[0]).to.not.equal(feature); + expect(spy.getCalls().length).to.be(0); unmanaged.setMap(null); }); });