Set _tilezoom to undefined instead of null (#5888)

* Set _tilezoom to undefined instead of null

Set _tilezoom to undefined instead of null

Fix for #5871 https://github.com/Leaflet/Leaflet/issues/5871

* add test
This commit is contained in:
iH8 2017-11-13 14:27:52 +01:00 committed by Per Liedman
parent a5a8f44ed2
commit abc3bf3027
2 changed files with 11 additions and 2 deletions

View File

@ -1008,4 +1008,13 @@ describe('GridLayer', function () {
}).to.throwError('Attempted to load an infinite number of tiles');
});
});
it("doesn't call map's getZoomScale method with null after _invalidateAll method was called", function () {
map.setView([0, 0], 0);
var grid = L.gridLayer().addTo(map);
var wrapped = sinon.spy(map, 'getZoomScale');
grid._invalidateAll();
grid.redraw();
expect(wrapped.neverCalledWith(sinon.match.any, null)).to.be(true);
});
});

View File

@ -172,7 +172,7 @@ export var GridLayer = Layer.extend({
DomUtil.remove(this._container);
map._removeZoomLimit(this);
this._container = null;
this._tileZoom = null;
this._tileZoom = undefined;
},
// @method bringToFront: this
@ -466,7 +466,7 @@ export var GridLayer = Layer.extend({
}
this._removeAllTiles();
this._tileZoom = null;
this._tileZoom = undefined;
},
_retainParent: function (x, y, z, minZoom) {