Disallowed undefined 'maxResolution' value
This commit is contained in:
@@ -152,7 +152,7 @@ ol.layer.Base.prototype.getLayerState = function() {
|
|||||||
sourceState: sourceState,
|
sourceState: sourceState,
|
||||||
visible: visible,
|
visible: visible,
|
||||||
extent: extent,
|
extent: extent,
|
||||||
maxResolution: goog.isDef(maxResolution) ? maxResolution : Infinity,
|
maxResolution: maxResolution,
|
||||||
minResolution: goog.isDef(minResolution) ? Math.max(minResolution, 0) : 0
|
minResolution: goog.isDef(minResolution) ? Math.max(minResolution, 0) : 0
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -190,12 +190,12 @@ goog.exportProperty(
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {number|undefined} The maximum resolution of the layer.
|
* @return {number} The maximum resolution of the layer.
|
||||||
* @observable
|
* @observable
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.layer.Base.prototype.getMaxResolution = function() {
|
ol.layer.Base.prototype.getMaxResolution = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number} */ (
|
||||||
this.get(ol.layer.LayerProperty.MAX_RESOLUTION));
|
this.get(ol.layer.LayerProperty.MAX_RESOLUTION));
|
||||||
};
|
};
|
||||||
goog.exportProperty(
|
goog.exportProperty(
|
||||||
@@ -349,7 +349,7 @@ goog.exportProperty(
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number|undefined} maxResolution The maximum resolution of the layer.
|
* @param {number} maxResolution The maximum resolution of the layer.
|
||||||
* @observable
|
* @observable
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ describe('ol.layer.Layer', function() {
|
|||||||
expect(layer.getVisible()).to.be(true);
|
expect(layer.getVisible()).to.be(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('provides default max resolution', function() {
|
||||||
|
expect(layer.getMaxResolution()).to.be(Infinity);
|
||||||
|
});
|
||||||
|
|
||||||
it('provides default layerState', function() {
|
it('provides default layerState', function() {
|
||||||
expect(layer.getLayerState()).to.eql({
|
expect(layer.getLayerState()).to.eql({
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|||||||
Reference in New Issue
Block a user