diff --git a/src/ol/view.js b/src/ol/view.js index fad56ddd13..37bbdb3c86 100644 --- a/src/ol/view.js +++ b/src/ol/view.js @@ -351,12 +351,12 @@ ol.View.prototype.getResolutionForValueFunction = function(opt_power) { /** - * @return {number|undefined} The rotation of the view. + * @return {number} The rotation of the view. * @observable * @api stable */ ol.View.prototype.getRotation = function() { - return /** @type {number|undefined} */ (this.get(ol.ViewProperty.ROTATION)); + return /** @type {number} */ (this.get(ol.ViewProperty.ROTATION)); }; goog.exportProperty( ol.View.prototype, @@ -402,7 +402,7 @@ ol.View.prototype.getState = function() { center: center.slice(), projection: goog.isDef(projection) ? projection : null, resolution: resolution, - rotation: goog.isDef(rotation) ? rotation : 0 + rotation: rotation }); }; @@ -626,7 +626,7 @@ goog.exportProperty( /** * Set the rotation for this view. - * @param {number|undefined} rotation The rotation of the view. + * @param {number} rotation The rotation of the view. * @observable * @api stable */ diff --git a/test/spec/ol/view.test.js b/test/spec/ol/view.test.js index fe35e8d646..c4f3eb02cd 100644 --- a/test/spec/ol/view.test.js +++ b/test/spec/ol/view.test.js @@ -1,6 +1,24 @@ goog.provide('ol.test.View'); describe('ol.View', function() { + + describe('constructor (defaults)', function() { + var view; + + beforeEach(function() { + view = new ol.View(); + }); + + it('creates an instance', function() { + expect(view).to.be.a(ol.View); + }); + + it('provides default rotation', function() { + expect(view.getRotation()).to.be(0); + }); + + }); + describe('create constraints', function() { describe('create resolution constraint', function() {