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:
Tim Schaub
2018-01-11 23:32:36 -07:00
parent 0bf2b04dee
commit ad62739a6e
684 changed files with 18120 additions and 18184 deletions
+37 -37
View File
@@ -10,7 +10,7 @@ describe('ol.source.XYZ', function() {
describe('constructor', function() {
it('can be constructed without options', function() {
var source = new XYZ();
const source = new XYZ();
expect(source).to.be.an(XYZ);
expect(source).to.be.an(TileImage);
expect(source).to.be.an(UrlTile);
@@ -18,22 +18,22 @@ describe('ol.source.XYZ', function() {
});
it('can be constructed with a custom tile grid', function() {
var tileGrid = _ol_tilegrid_.createXYZ();
var tileSource = new XYZ({
const tileGrid = _ol_tilegrid_.createXYZ();
const tileSource = new XYZ({
tileGrid: tileGrid
});
expect(tileSource.getTileGrid()).to.be(tileGrid);
});
it('can be constructed with a custom tile size', function() {
var tileSource = new XYZ({
const tileSource = new XYZ({
tileSize: 512
});
expect(tileSource.getTileGrid().getTileSize(0)).to.be(512);
});
it('can be constructed with a custom min zoom', function() {
var tileSource = new XYZ({
const tileSource = new XYZ({
minZoom: 2
});
expect(tileSource.getTileGrid().getMinZoom()).to.be(2);
@@ -43,7 +43,7 @@ describe('ol.source.XYZ', function() {
describe('tileUrlFunction', function() {
var xyzTileSource, tileGrid;
let xyzTileSource, tileGrid;
beforeEach(function() {
xyzTileSource = new XYZ({
@@ -55,35 +55,35 @@ describe('ol.source.XYZ', function() {
it('returns the expected URL', function() {
var coordinate = [829330.2064098881, 5933916.615134273];
var tileUrl;
const coordinate = [829330.2064098881, 5933916.615134273];
let tileUrl;
tileUrl = xyzTileSource.tileUrlFunction(
tileGrid.getTileCoordForCoordAndZ(coordinate, 0));
tileGrid.getTileCoordForCoordAndZ(coordinate, 0));
expect(tileUrl).to.eql('0/0/0');
tileUrl = xyzTileSource.tileUrlFunction(
tileGrid.getTileCoordForCoordAndZ(coordinate, 1));
tileGrid.getTileCoordForCoordAndZ(coordinate, 1));
expect(tileUrl).to.eql('1/1/0');
tileUrl = xyzTileSource.tileUrlFunction(
tileGrid.getTileCoordForCoordAndZ(coordinate, 2));
tileGrid.getTileCoordForCoordAndZ(coordinate, 2));
expect(tileUrl).to.eql('2/2/1');
tileUrl = xyzTileSource.tileUrlFunction(
tileGrid.getTileCoordForCoordAndZ(coordinate, 3));
tileGrid.getTileCoordForCoordAndZ(coordinate, 3));
expect(tileUrl).to.eql('3/4/2');
tileUrl = xyzTileSource.tileUrlFunction(
tileGrid.getTileCoordForCoordAndZ(coordinate, 4));
tileGrid.getTileCoordForCoordAndZ(coordinate, 4));
expect(tileUrl).to.eql('4/8/5');
tileUrl = xyzTileSource.tileUrlFunction(
tileGrid.getTileCoordForCoordAndZ(coordinate, 5));
tileGrid.getTileCoordForCoordAndZ(coordinate, 5));
expect(tileUrl).to.eql('5/16/11');
tileUrl = xyzTileSource.tileUrlFunction(
tileGrid.getTileCoordForCoordAndZ(coordinate, 6));
tileGrid.getTileCoordForCoordAndZ(coordinate, 6));
expect(tileUrl).to.eql('6/33/22');
});
@@ -91,20 +91,20 @@ describe('ol.source.XYZ', function() {
describe('wrap x', function() {
it('returns the expected URL', function() {
var projection = xyzTileSource.getProjection();
var tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
[6, -31, -23], projection));
const projection = xyzTileSource.getProjection();
let tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
[6, -31, -23], projection));
expect(tileUrl).to.eql('6/33/22');
tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 33, -23], projection));
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 33, -23], projection));
expect(tileUrl).to.eql('6/33/22');
tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 97, -23], projection));
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 97, -23], projection));
expect(tileUrl).to.eql('6/33/22');
});
@@ -113,20 +113,20 @@ describe('ol.source.XYZ', function() {
describe('crop y', function() {
it('returns the expected URL', function() {
var projection = xyzTileSource.getProjection();
var tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 33, 0], projection));
const projection = xyzTileSource.getProjection();
let tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 33, 0], projection));
expect(tileUrl).to.be(undefined);
tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 33, -23], projection));
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 33, -23], projection));
expect(tileUrl).to.eql('6/33/22');
tileUrl = xyzTileSource.tileUrlFunction(
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 33, -65], projection));
xyzTileSource.getTileCoordForTileUrlFunction(
[6, 33, -65], projection));
expect(tileUrl).to.be(undefined);
});
@@ -136,9 +136,9 @@ describe('ol.source.XYZ', 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 = {
@@ -153,7 +153,7 @@ describe('ol.source.XYZ', function() {
});
it('returns the XYZ URL', function() {
var urls = source.getUrls();
const urls = source.getUrls();
expect(urls).to.be.eql([url]);
});
@@ -166,7 +166,7 @@ describe('ol.source.XYZ', 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']);
});
@@ -181,7 +181,7 @@ describe('ol.source.XYZ', function() {
});
it('returns null', function() {
var urls = source.getUrls();
const urls = source.getUrls();
expect(urls).to.be(null);
});