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:
@@ -8,13 +8,13 @@ describe('ol.source.BingMaps', function() {
|
||||
|
||||
describe('#tileUrlFunction()', function() {
|
||||
|
||||
var source, tileGrid;
|
||||
let source, tileGrid;
|
||||
|
||||
beforeEach(function(done) {
|
||||
var olNetJsonp = _ol_net_.jsonp;
|
||||
const olNetJsonp = _ol_net_.jsonp;
|
||||
// mock ol.net.Jsonp (used in the ol.source.TileJSON constructor)
|
||||
_ol_net_.jsonp = function(url, callback) {
|
||||
var client = new XMLHttpRequest();
|
||||
const client = new XMLHttpRequest();
|
||||
client.open('GET', 'spec/ol/data/bing_aerialwithlabels.json', true);
|
||||
client.onload = function() {
|
||||
callback(JSON.parse(client.responseText));
|
||||
@@ -26,7 +26,7 @@ describe('ol.source.BingMaps', function() {
|
||||
key: ''
|
||||
});
|
||||
_ol_net_.jsonp = olNetJsonp;
|
||||
var key = source.on('change', function() {
|
||||
const key = source.on('change', function() {
|
||||
if (source.getState() === 'ready') {
|
||||
Observable.unByKey(key);
|
||||
tileGrid = source.getTileGrid();
|
||||
@@ -45,36 +45,36 @@ describe('ol.source.BingMaps', function() {
|
||||
|
||||
it('returns the expected URL', function() {
|
||||
|
||||
var coordinate = [829330.2064098881, 5933916.615134273];
|
||||
var projection = source.getProjection();
|
||||
var regex = /\/tiles\/h(.*)\.jpeg/;
|
||||
var tileUrl;
|
||||
const coordinate = [829330.2064098881, 5933916.615134273];
|
||||
const projection = source.getProjection();
|
||||
const regex = /\/tiles\/h(.*)\.jpeg/;
|
||||
let tileUrl;
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 1), 1, projection);
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 1), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(_ol_tilecoord_.quadKey([1, 1, 0]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 2), 1, projection);
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 2), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(_ol_tilecoord_.quadKey([2, 2, 1]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 3), 1, projection);
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 3), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(_ol_tilecoord_.quadKey([3, 4, 2]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 4), 1, projection);
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 4), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(_ol_tilecoord_.quadKey([4, 8, 5]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 5), 1, projection);
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 5), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(_ol_tilecoord_.quadKey(
|
||||
[5, 16, 11]));
|
||||
[5, 16, 11]));
|
||||
|
||||
tileUrl = source.tileUrlFunction(
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 6), 1, projection);
|
||||
tileGrid.getTileCoordForCoordAndZ(coordinate, 6), 1, projection);
|
||||
expect(tileUrl.match(regex)[1]).to.equal(_ol_tilecoord_.quadKey(
|
||||
[6, 33, 22]));
|
||||
[6, 33, 22]));
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user