diff --git a/spec/suites/layer/tile/GridLayerSpec.js b/spec/suites/layer/tile/GridLayerSpec.js index 60214078..1a48ce70 100644 --- a/spec/suites/layer/tile/GridLayerSpec.js +++ b/spec/suites/layer/tile/GridLayerSpec.js @@ -16,6 +16,22 @@ describe('GridLayer', function () { document.body.removeChild(div); }); + describe('#redraw', function () { + it('can be called before map.setView', function () { + var map = L.map(div), + grid = L.gridLayer().addTo(map); + expect(grid.redraw()).to.equal(grid); + }); + }); + + describe('#setOpacity', function () { + it('can be called before map.setView', function () { + var map = L.map(div), + grid = L.gridLayer().addTo(map); + expect(grid.setOpacity(0.5)).to.equal(grid); + }); + }); + it('positions tiles correctly with wrapping and bounding', function () { var map = L.map(div).setView([0, 0], 1); diff --git a/src/layer/tile/GridLayer.js b/src/layer/tile/GridLayer.js index 143ac35d..0138b9d6 100644 --- a/src/layer/tile/GridLayer.js +++ b/src/layer/tile/GridLayer.js @@ -53,7 +53,7 @@ L.GridLayer = L.Layer.extend({ }, bringToFront: function () { - if (this._map) { + if (this._container) { var pane = this.getPane(); pane.appendChild(this._container); this._setAutoZIndex(pane, Math.max); @@ -62,7 +62,7 @@ L.GridLayer = L.Layer.extend({ }, bringToBack: function () { - if (this._map) { + if (this._container) { var pane = this.getPane(); pane.insertBefore(this._container, pane.firstChild); this._setAutoZIndex(pane, Math.min); @@ -81,7 +81,7 @@ L.GridLayer = L.Layer.extend({ setOpacity: function (opacity) { this.options.opacity = opacity; - if (this._map) { + if (this._container) { this._updateOpacity(); } return this; @@ -95,7 +95,7 @@ L.GridLayer = L.Layer.extend({ }, redraw: function () { - if (this._map) { + if (this._container) { this._reset({hard: true}); this._update(); }