Use blocked scoped variables
In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
@@ -4,7 +4,7 @@ import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
|
||||
describe('ol.source.ImageArcGISRest', function() {
|
||||
|
||||
var pixelRatio, options, projection, proj3857, resolution;
|
||||
let pixelRatio, options, projection, proj3857, resolution;
|
||||
beforeEach(function() {
|
||||
pixelRatio = 1;
|
||||
projection = getProjection('EPSG:4326');
|
||||
@@ -19,13 +19,13 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
describe('#getImage', function() {
|
||||
|
||||
it('returns a image with the expected URL', function() {
|
||||
var source = new ImageArcGISRest(options);
|
||||
var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857);
|
||||
var uri = new URL(image.src_);
|
||||
const source = new ImageArcGISRest(options);
|
||||
const image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857);
|
||||
const uri = new URL(image.src_);
|
||||
expect(uri.protocol).to.be('http:');
|
||||
expect(uri.hostname).to.be('example.com');
|
||||
expect(uri.pathname).to.be('/MapServer/export');
|
||||
var queryData = uri.searchParams;
|
||||
const queryData = uri.searchParams;
|
||||
expect(queryData.get('BBOX')).to.be('5.5,2.25,-9.5,0.75');
|
||||
expect(queryData.get('FORMAT')).to.be('PNG32');
|
||||
expect(queryData.get('IMAGESR')).to.be('3857');
|
||||
@@ -35,22 +35,22 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
});
|
||||
|
||||
it('returns a non floating point DPI value', function() {
|
||||
var source = new ImageArcGISRest(options);
|
||||
var image = source.getImage([3, 2, -7, 1.12], resolution, 1.01, proj3857);
|
||||
var uri = new URL(image.src_);
|
||||
var queryData = uri.searchParams;
|
||||
const source = new ImageArcGISRest(options);
|
||||
const image = source.getImage([3, 2, -7, 1.12], resolution, 1.01, proj3857);
|
||||
const uri = new URL(image.src_);
|
||||
const queryData = uri.searchParams;
|
||||
expect(queryData.get('DPI')).to.be('91');
|
||||
});
|
||||
|
||||
it('returns a image with the expected URL for ImageServer', function() {
|
||||
options.url = 'http://example.com/ImageServer';
|
||||
var source = new ImageArcGISRest(options);
|
||||
var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857);
|
||||
var uri = new URL(image.src_);
|
||||
const source = new ImageArcGISRest(options);
|
||||
const image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857);
|
||||
const uri = new URL(image.src_);
|
||||
expect(uri.protocol).to.be('http:');
|
||||
expect(uri.hostname).to.be('example.com');
|
||||
expect(uri.pathname).to.be('/ImageServer/exportImage');
|
||||
var queryData = uri.searchParams;
|
||||
const queryData = uri.searchParams;
|
||||
expect(queryData.get('BBOX')).to.be('5.5,2.25,-9.5,0.75');
|
||||
expect(queryData.get('FORMAT')).to.be('PNG32');
|
||||
expect(queryData.get('IMAGESR')).to.be('3857');
|
||||
@@ -61,20 +61,20 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
it('allows various parameters to be overridden', function() {
|
||||
options.params.FORMAT = 'png';
|
||||
options.params.TRANSPARENT = false;
|
||||
var source = new ImageArcGISRest(options);
|
||||
var image = source.getImage([3, 2, -3, 1], resolution, pixelRatio, projection);
|
||||
var uri = new URL(image.src_);
|
||||
var queryData = uri.searchParams;
|
||||
const source = new ImageArcGISRest(options);
|
||||
const image = source.getImage([3, 2, -3, 1], resolution, pixelRatio, projection);
|
||||
const uri = new URL(image.src_);
|
||||
const queryData = uri.searchParams;
|
||||
expect(queryData.get('FORMAT')).to.be('png');
|
||||
expect(queryData.get('TRANSPARENT')).to.be('false');
|
||||
});
|
||||
|
||||
it('allows adding rest option', function() {
|
||||
options.params.LAYERS = 'show:1,3,4';
|
||||
var source = new ImageArcGISRest(options);
|
||||
var image = source.getImage([3, 2, -3, 1], resolution, pixelRatio, proj3857);
|
||||
var uri = new URL(image.src_);
|
||||
var queryData = uri.searchParams;
|
||||
const source = new ImageArcGISRest(options);
|
||||
const image = source.getImage([3, 2, -3, 1], resolution, pixelRatio, proj3857);
|
||||
const uri = new URL(image.src_);
|
||||
const queryData = uri.searchParams;
|
||||
expect(queryData.get('LAYERS')).to.be('show:1,3,4');
|
||||
});
|
||||
});
|
||||
@@ -82,24 +82,24 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
describe('#updateParams', function() {
|
||||
|
||||
it('add a new param', function() {
|
||||
var source = new ImageArcGISRest(options);
|
||||
const source = new ImageArcGISRest(options);
|
||||
source.updateParams({'TEST': 'value'});
|
||||
|
||||
var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857);
|
||||
var uri = new URL(image.src_);
|
||||
var queryData = uri.searchParams;
|
||||
const image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857);
|
||||
const uri = new URL(image.src_);
|
||||
const queryData = uri.searchParams;
|
||||
expect(queryData.get('TEST')).to.be('value');
|
||||
});
|
||||
|
||||
it('updates an existing param', function() {
|
||||
options.params.TEST = 'value';
|
||||
|
||||
var source = new ImageArcGISRest(options);
|
||||
const source = new ImageArcGISRest(options);
|
||||
source.updateParams({'TEST': 'newValue'});
|
||||
|
||||
var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857);
|
||||
var uri = new URL(image.src_);
|
||||
var queryData = uri.searchParams;
|
||||
const image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857);
|
||||
const uri = new URL(image.src_);
|
||||
const queryData = uri.searchParams;
|
||||
expect(queryData.get('TEST')).to.be('newValue');
|
||||
});
|
||||
|
||||
@@ -109,9 +109,9 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
|
||||
it('verify getting a param', function() {
|
||||
options.params.TEST = 'value';
|
||||
var source = new ImageArcGISRest(options);
|
||||
const source = new ImageArcGISRest(options);
|
||||
|
||||
var setParams = source.getParams();
|
||||
const setParams = source.getParams();
|
||||
|
||||
expect(setParams).to.eql({TEST: 'value'});
|
||||
});
|
||||
@@ -119,10 +119,10 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
it('verify on adding a param', function() {
|
||||
options.params.TEST = 'value';
|
||||
|
||||
var source = new ImageArcGISRest(options);
|
||||
const source = new ImageArcGISRest(options);
|
||||
source.updateParams({'TEST2': 'newValue'});
|
||||
|
||||
var setParams = source.getParams();
|
||||
const setParams = source.getParams();
|
||||
|
||||
expect(setParams).to.eql({TEST: 'value', TEST2: 'newValue'});
|
||||
});
|
||||
@@ -130,10 +130,10 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
it('verify on update a param', function() {
|
||||
options.params.TEST = 'value';
|
||||
|
||||
var source = new ImageArcGISRest(options);
|
||||
const source = new ImageArcGISRest(options);
|
||||
source.updateParams({'TEST': 'newValue'});
|
||||
|
||||
var setParams = source.getParams();
|
||||
const setParams = source.getParams();
|
||||
|
||||
expect(setParams).to.eql({TEST: 'newValue'});
|
||||
});
|
||||
@@ -145,9 +145,9 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
it('verify getting url', function() {
|
||||
options.url = 'http://test.com/MapServer';
|
||||
|
||||
var source = new ImageArcGISRest(options);
|
||||
const source = new ImageArcGISRest(options);
|
||||
|
||||
var url = source.getUrl();
|
||||
const url = source.getUrl();
|
||||
|
||||
expect(url).to.eql('http://test.com/MapServer');
|
||||
});
|
||||
@@ -159,10 +159,10 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
|
||||
it('verify setting url when not set yet', function() {
|
||||
|
||||
var source = new ImageArcGISRest(options);
|
||||
const source = new ImageArcGISRest(options);
|
||||
source.setUrl('http://test.com/MapServer');
|
||||
|
||||
var url = source.getUrl();
|
||||
const url = source.getUrl();
|
||||
|
||||
expect(url).to.eql('http://test.com/MapServer');
|
||||
});
|
||||
@@ -170,10 +170,10 @@ describe('ol.source.ImageArcGISRest', function() {
|
||||
it('verify setting url with existing url', function() {
|
||||
options.url = 'http://test.com/MapServer';
|
||||
|
||||
var source = new ImageArcGISRest(options);
|
||||
const source = new ImageArcGISRest(options);
|
||||
source.setUrl('http://test2.com/MapServer');
|
||||
|
||||
var url = source.getUrl();
|
||||
const url = source.getUrl();
|
||||
|
||||
expect(url).to.eql('http://test2.com/MapServer');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user