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:
@@ -11,12 +11,12 @@ describe('ol.proj.EPSG3857', function() {
|
||||
describe('fromEPSG4326()', function() {
|
||||
|
||||
it('transforms from geographic to Web Mercator', function() {
|
||||
var forward = _ol_proj_EPSG3857_.fromEPSG4326;
|
||||
var edge = _ol_proj_EPSG3857_.HALF_SIZE;
|
||||
const forward = _ol_proj_EPSG3857_.fromEPSG4326;
|
||||
const edge = _ol_proj_EPSG3857_.HALF_SIZE;
|
||||
|
||||
var tolerance = 1e-5;
|
||||
const tolerance = 1e-5;
|
||||
|
||||
var cases = [{
|
||||
const cases = [{
|
||||
g: [0, 0],
|
||||
m: [0, 0]
|
||||
}, {
|
||||
@@ -30,9 +30,9 @@ describe('ol.proj.EPSG3857', function() {
|
||||
m: [-12361239.084208, 5728738.469095]
|
||||
}];
|
||||
|
||||
for (var i = 0, ii = cases.length; i < ii; ++i) {
|
||||
var point = cases[i].g;
|
||||
var transformed = forward(point);
|
||||
for (let i = 0, ii = cases.length; i < ii; ++i) {
|
||||
const point = cases[i].g;
|
||||
const transformed = forward(point);
|
||||
expect(transformed[0]).to.roughlyEqual(cases[i].m[0], tolerance);
|
||||
expect(transformed[1]).to.roughlyEqual(cases[i].m[1], tolerance);
|
||||
}
|
||||
@@ -44,34 +44,34 @@ describe('ol.proj.EPSG3857', function() {
|
||||
|
||||
it('returns the correct point scale at the equator', function() {
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
var epsg3857 = getProjection('EPSG:3857');
|
||||
var resolution = 19.11;
|
||||
var point = [0, 0];
|
||||
const epsg3857 = getProjection('EPSG:3857');
|
||||
const resolution = 19.11;
|
||||
const point = [0, 0];
|
||||
expect(getPointResolution(epsg3857, resolution, point)).
|
||||
to.roughlyEqual(19.11, 1e-1);
|
||||
to.roughlyEqual(19.11, 1e-1);
|
||||
});
|
||||
|
||||
it('returns the correct point scale at the latitude of Toronto',
|
||||
function() {
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
var epsg3857 = getProjection('EPSG:3857');
|
||||
var epsg4326 = getProjection('EPSG:4326');
|
||||
var resolution = 19.11;
|
||||
var point = transform([0, 43.65], epsg4326, epsg3857);
|
||||
expect(getPointResolution(epsg3857, resolution, point)).
|
||||
to.roughlyEqual(19.11 * Math.cos(Math.PI * 43.65 / 180), 1e-9);
|
||||
});
|
||||
function() {
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
const epsg3857 = getProjection('EPSG:3857');
|
||||
const epsg4326 = getProjection('EPSG:4326');
|
||||
const resolution = 19.11;
|
||||
const point = transform([0, 43.65], epsg4326, epsg3857);
|
||||
expect(getPointResolution(epsg3857, resolution, point)).
|
||||
to.roughlyEqual(19.11 * Math.cos(Math.PI * 43.65 / 180), 1e-9);
|
||||
});
|
||||
|
||||
it('returns the correct point scale at various latitudes', function() {
|
||||
// @see http://msdn.microsoft.com/en-us/library/aa940990.aspx
|
||||
var epsg3857 = getProjection('EPSG:3857');
|
||||
var epsg4326 = getProjection('EPSG:4326');
|
||||
var resolution = 19.11;
|
||||
var latitude;
|
||||
const epsg3857 = getProjection('EPSG:3857');
|
||||
const epsg4326 = getProjection('EPSG:4326');
|
||||
const resolution = 19.11;
|
||||
let latitude;
|
||||
for (latitude = 0; latitude <= 85; ++latitude) {
|
||||
var point = transform([0, latitude], epsg4326, epsg3857);
|
||||
const point = transform([0, latitude], epsg4326, epsg3857);
|
||||
expect(getPointResolution(epsg3857, resolution, point)).
|
||||
to.roughlyEqual(19.11 * Math.cos(Math.PI * latitude / 180), 1e-9);
|
||||
to.roughlyEqual(19.11 * Math.cos(Math.PI * latitude / 180), 1e-9);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -4,27 +4,27 @@ import * as transforms from '../../../../src/ol/proj/transforms.js';
|
||||
|
||||
describe('transforms.remove()', function() {
|
||||
|
||||
var extent = [180, -90, 180, 90];
|
||||
var units = 'degrees';
|
||||
const extent = [180, -90, 180, 90];
|
||||
const units = 'degrees';
|
||||
|
||||
it('removes functions cached by transforms.add()', function() {
|
||||
var foo = new Projection({
|
||||
const foo = new Projection({
|
||||
code: 'foo',
|
||||
units: units,
|
||||
extent: extent
|
||||
});
|
||||
var bar = new Projection({
|
||||
const bar = new Projection({
|
||||
code: 'bar',
|
||||
units: units,
|
||||
extent: extent
|
||||
});
|
||||
var transform = function(input, output, dimension) {
|
||||
const transform = function(input, output, dimension) {
|
||||
return input;
|
||||
};
|
||||
transforms.add(foo, bar, transform);
|
||||
expect(transforms.get('foo', 'bar')).to.be(transform);
|
||||
|
||||
var removed = transforms.remove(foo, bar);
|
||||
const removed = transforms.remove(foo, bar);
|
||||
expect(removed).to.be(transform);
|
||||
expect(transforms.get('foo', 'bar')).to.be(undefined);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user