Add support for layers lacking Events mixin. Fixes #1962
This commit is contained in:
parent
6c77fe64c2
commit
befc5eb992
@ -47,6 +47,16 @@
|
|||||||
|
|
||||||
expect(fg.hasLayer(marker)).to.be(true);
|
expect(fg.hasLayer(marker)).to.be(true);
|
||||||
});
|
});
|
||||||
|
it('supports non-evented layers', function () {
|
||||||
|
var fg = L.featureGroup(),
|
||||||
|
g = L.layerGroup();
|
||||||
|
|
||||||
|
expect(fg.hasLayer(g)).to.be(false);
|
||||||
|
|
||||||
|
fg.addLayer(g);
|
||||||
|
|
||||||
|
expect(fg.hasLayer(g)).to.be(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('removeLayer', function () {
|
describe('removeLayer', function () {
|
||||||
it('removes the layer passed to it', function () {
|
it('removes the layer passed to it', function () {
|
||||||
|
@ -15,7 +15,9 @@ L.FeatureGroup = L.LayerGroup.extend({
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('on' in layer) {
|
||||||
layer.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
|
layer.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
|
||||||
|
}
|
||||||
|
|
||||||
L.LayerGroup.prototype.addLayer.call(this, layer);
|
L.LayerGroup.prototype.addLayer.call(this, layer);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user