make resolution in getGetLegendGraphicUrl optional

This commit is contained in:
simonseyock
2019-07-08 15:14:06 +02:00
parent f493f01bd0
commit c0000e745e
4 changed files with 40 additions and 19 deletions
+9 -1
View File
@@ -332,7 +332,7 @@ describe('ol.source.ImageWMS', function() {
describe('#getGetLegendGraphicUrl', function() {
it('returns the getLegenGraphic url as expected', function() {
it('returns the getLegendGraphic url as expected', function() {
const source = new ImageWMS(options);
const url = source.getGetLegendGraphicUrl(resolution);
const uri = new URL(url);
@@ -348,6 +348,14 @@ describe('ol.source.ImageWMS', function() {
expect(queryData.get('SCALE')).to.be('357.14214285714274');
});
it('does not include SCALE if no resolution was provided', function() {
const source = new ImageWMS(options);
const url = source.getGetLegendGraphicUrl();
const uri = new URL(url);
const queryData = uri.searchParams;
expect(queryData.get('SCALE')).to.be(null);
});
it('adds additional params as expected', function() {
const source = new ImageWMS(options);
const url = source.getGetLegendGraphicUrl(resolution, {
+8
View File
@@ -317,6 +317,14 @@ describe('ol.source.TileWMS', function() {
expect(queryData.get('SCALE')).to.be('357.14214285714274');
});
it('does not include SCALE if no resolution was provided', function() {
const source = new TileWMS(options);
const url = source.getGetLegendGraphicUrl();
const uri = new URL(url);
const queryData = uri.searchParams;
expect(queryData.get('SCALE')).to.be(null);
});
it('adds additional params as expected', function() {
const source = new TileWMS(options);
const url = source.getGetLegendGraphicUrl(0.1, {