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:
@@ -7,18 +7,18 @@ describe('ol.source.UrlTile', function() {
|
||||
|
||||
describe('#setUrl()', function() {
|
||||
it('sets the URL for the source', function() {
|
||||
var source = new UrlTile({});
|
||||
const source = new UrlTile({});
|
||||
|
||||
var url = 'https://example.com/';
|
||||
const url = 'https://example.com/';
|
||||
source.setUrl(url);
|
||||
|
||||
expect(source.getUrls()).to.eql([url]);
|
||||
});
|
||||
|
||||
it('updates the key for the source', function() {
|
||||
var source = new UrlTile({});
|
||||
const source = new UrlTile({});
|
||||
|
||||
var url = 'https://example.com/';
|
||||
const url = 'https://example.com/';
|
||||
source.setUrl(url);
|
||||
|
||||
expect(source.getKey()).to.eql(url);
|
||||
@@ -27,9 +27,9 @@ describe('ol.source.UrlTile', function() {
|
||||
|
||||
describe('#setUrls()', function() {
|
||||
it('sets the URL for the source', function() {
|
||||
var source = new UrlTile({});
|
||||
const source = new UrlTile({});
|
||||
|
||||
var urls = [
|
||||
const urls = [
|
||||
'https://a.example.com/',
|
||||
'https://b.example.com/',
|
||||
'https://c.example.com/'
|
||||
@@ -40,9 +40,9 @@ describe('ol.source.UrlTile', function() {
|
||||
});
|
||||
|
||||
it('updates the key for the source', function() {
|
||||
var source = new UrlTile({});
|
||||
const source = new UrlTile({});
|
||||
|
||||
var urls = [
|
||||
const urls = [
|
||||
'https://a.example.com/',
|
||||
'https://b.example.com/',
|
||||
'https://c.example.com/'
|
||||
@@ -55,18 +55,18 @@ describe('ol.source.UrlTile', function() {
|
||||
|
||||
describe('url option', function() {
|
||||
it('expands url template', function() {
|
||||
var tileSource = new UrlTile({
|
||||
const tileSource = new UrlTile({
|
||||
url: '{1-3}'
|
||||
});
|
||||
|
||||
var urls = tileSource.getUrls();
|
||||
const urls = tileSource.getUrls();
|
||||
expect(urls).to.eql(['1', '2', '3']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('tileUrlFunction', function() {
|
||||
|
||||
var tileSource, tileGrid;
|
||||
let tileSource, tileGrid;
|
||||
|
||||
beforeEach(function() {
|
||||
tileSource = new UrlTile({
|
||||
@@ -80,35 +80,35 @@ describe('ol.source.UrlTile', function() {
|
||||
|
||||
it('returns the expected URL', function() {
|
||||
|
||||
var coordinate = [829330.2064098881, 5933916.615134273];
|
||||
var tileUrl;
|
||||
const coordinate = [829330.2064098881, 5933916.615134273];
|
||||
let tileUrl;
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 0));
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 0));
|
||||
expect(tileUrl).to.eql('0/0/0');
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 1));
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 1));
|
||||
expect(tileUrl).to.eql('1/1/0');
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 2));
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 2));
|
||||
expect(tileUrl).to.eql('2/2/1');
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 3));
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 3));
|
||||
expect(tileUrl).to.eql('3/4/2');
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 4));
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 4));
|
||||
expect(tileUrl).to.eql('4/8/5');
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 5));
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 5));
|
||||
expect(tileUrl).to.eql('5/16/11');
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 6));
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 6));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
|
||||
});
|
||||
@@ -116,20 +116,20 @@ describe('ol.source.UrlTile', function() {
|
||||
describe('wrap x', function() {
|
||||
|
||||
it('returns the expected URL', function() {
|
||||
var projection = tileSource.getProjection();
|
||||
var tileUrl = tileSource.tileUrlFunction(
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, -31, -23], projection));
|
||||
const projection = tileSource.getProjection();
|
||||
let tileUrl = tileSource.tileUrlFunction(
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, -31, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, -23], projection));
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 97, -23], projection));
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 97, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
});
|
||||
|
||||
@@ -138,20 +138,20 @@ describe('ol.source.UrlTile', function() {
|
||||
describe('crop y', function() {
|
||||
|
||||
it('returns the expected URL', function() {
|
||||
var projection = tileSource.getProjection();
|
||||
var tileUrl = tileSource.tileUrlFunction(
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, 0], projection));
|
||||
const projection = tileSource.getProjection();
|
||||
let tileUrl = tileSource.tileUrlFunction(
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, 0], projection));
|
||||
expect(tileUrl).to.be(undefined);
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, -23], projection));
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, -23], projection));
|
||||
expect(tileUrl).to.eql('6/33/22');
|
||||
|
||||
tileUrl = tileSource.tileUrlFunction(
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, -65], projection));
|
||||
tileSource.getTileCoordForTileUrlFunction(
|
||||
[6, 33, -65], projection));
|
||||
expect(tileUrl).to.be(undefined);
|
||||
});
|
||||
|
||||
@@ -161,9 +161,9 @@ describe('ol.source.UrlTile', function() {
|
||||
|
||||
describe('#getUrls', function() {
|
||||
|
||||
var sourceOptions;
|
||||
var source;
|
||||
var url = 'http://geo.nls.uk/maps/towns/glasgow1857/{z}/{x}/{-y}.png';
|
||||
let sourceOptions;
|
||||
let source;
|
||||
const url = 'http://geo.nls.uk/maps/towns/glasgow1857/{z}/{x}/{-y}.png';
|
||||
|
||||
beforeEach(function() {
|
||||
sourceOptions = {
|
||||
@@ -180,7 +180,7 @@ describe('ol.source.UrlTile', function() {
|
||||
});
|
||||
|
||||
it('returns the XYZ URL', function() {
|
||||
var urls = source.getUrls();
|
||||
const urls = source.getUrls();
|
||||
expect(urls).to.be.eql([url]);
|
||||
});
|
||||
|
||||
@@ -193,7 +193,7 @@ describe('ol.source.UrlTile', function() {
|
||||
});
|
||||
|
||||
it('returns the XYZ URLs', function() {
|
||||
var urls = source.getUrls();
|
||||
const urls = source.getUrls();
|
||||
expect(urls).to.be.eql(['some_xyz_url1', 'some_xyz_url2']);
|
||||
});
|
||||
|
||||
@@ -208,7 +208,7 @@ describe('ol.source.UrlTile', function() {
|
||||
});
|
||||
|
||||
it('returns null', function() {
|
||||
var urls = source.getUrls();
|
||||
const urls = source.getUrls();
|
||||
expect(urls).to.be(null);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user