Disallowed undefined 'minResolution' value

This commit is contained in:
Frederic Junod
2015-01-27 18:07:08 +01:00
parent 1d6f7e9504
commit fc3c808209
2 changed files with 8 additions and 4 deletions

View File

@@ -153,7 +153,7 @@ ol.layer.Base.prototype.getLayerState = function() {
visible: visible, visible: visible,
extent: extent, extent: extent,
maxResolution: maxResolution, maxResolution: maxResolution,
minResolution: goog.isDef(minResolution) ? Math.max(minResolution, 0) : 0 minResolution: Math.max(minResolution, 0)
}; };
}; };
@@ -205,12 +205,12 @@ goog.exportProperty(
/** /**
* @return {number|undefined} The minimum resolution of the layer. * @return {number} The minimum resolution of the layer.
* @observable * @observable
* @api stable * @api stable
*/ */
ol.layer.Base.prototype.getMinResolution = function() { ol.layer.Base.prototype.getMinResolution = function() {
return /** @type {number|undefined} */ ( return /** @type {number} */ (
this.get(ol.layer.LayerProperty.MIN_RESOLUTION)); this.get(ol.layer.LayerProperty.MIN_RESOLUTION));
}; };
goog.exportProperty( goog.exportProperty(
@@ -363,7 +363,7 @@ goog.exportProperty(
/** /**
* @param {number|undefined} minResolution The minimum resolution of the layer. * @param {number} minResolution The minimum resolution of the layer.
* @observable * @observable
* @api stable * @api stable
*/ */

View File

@@ -50,6 +50,10 @@ describe('ol.layer.Layer', function() {
expect(layer.getMaxResolution()).to.be(Infinity); expect(layer.getMaxResolution()).to.be(Infinity);
}); });
it('provides default min resolution', function() {
expect(layer.getMinResolution()).to.be(0);
});
it('provides default layerState', function() { it('provides default layerState', function() {
expect(layer.getLayerState()).to.eql({ expect(layer.getLayerState()).to.eql({
layer: layer, layer: layer,