From 1b662ff048ea77551a0a3acc44c0df12190ce39b Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 8 Jun 2016 08:32:13 +0200 Subject: [PATCH] Use minZoom and maxZoom olx.source.StamenOptions --- src/ol/source/stamensource.js | 4 ++-- test/spec/ol/source/stamensource.test.js | 28 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 test/spec/ol/source/stamensource.test.js diff --git a/src/ol/source/stamensource.js b/src/ol/source/stamensource.js index 13c2635576..ba70a0af1f 100644 --- a/src/ol/source/stamensource.js +++ b/src/ol/source/stamensource.js @@ -105,8 +105,8 @@ ol.source.Stamen = function(options) { attributions: ol.source.Stamen.ATTRIBUTIONS, cacheSize: options.cacheSize, crossOrigin: 'anonymous', - maxZoom: providerConfig.maxZoom, - minZoom: providerConfig.minZoom, + maxZoom: options.maxZoom != undefined ? options.maxZoom : providerConfig.maxZoom, + minZoom: options.minZoom != undefined ? options.minZoom : providerConfig.minZoom, opaque: layerConfig.opaque, reprojectionErrorThreshold: options.reprojectionErrorThreshold, tileLoadFunction: options.tileLoadFunction, diff --git a/test/spec/ol/source/stamensource.test.js b/test/spec/ol/source/stamensource.test.js new file mode 100644 index 0000000000..189d16b139 --- /dev/null +++ b/test/spec/ol/source/stamensource.test.js @@ -0,0 +1,28 @@ +goog.provide('ol.test.source.Stamen'); + +describe('ol.source.Stamen', function() { + + describe('constructor', function() { + + it('can be constructed with a custom minZoom', function() { + var source = new ol.source.Stamen({ + layer: 'watercolor', + minZoom: 10 + }); + expect(source.getTileGrid().getMinZoom()).to.be(10); + }); + + it('can be constructed with a custom maxZoom', function() { + var source = new ol.source.Stamen({ + layer: 'watercolor', + maxZoom: 8 + }); + expect(source.getTileGrid().getMaxZoom()).to.be(8); + + }); + + }); + +}); + +goog.require('ol.source.Stamen');