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:
@@ -13,7 +13,7 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
describe('construct empty', function() {
|
||||
|
||||
var multiLineString;
|
||||
let multiLineString;
|
||||
beforeEach(function() {
|
||||
multiLineString = new MultiLineString([]);
|
||||
});
|
||||
@@ -40,23 +40,23 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('can append line strings', function() {
|
||||
multiLineString.appendLineString(
|
||||
new LineString([[1, 2], [3, 4]]));
|
||||
new LineString([[1, 2], [3, 4]]));
|
||||
expect(multiLineString.getCoordinates()).to.eql(
|
||||
[[[1, 2], [3, 4]]]);
|
||||
[[[1, 2], [3, 4]]]);
|
||||
multiLineString.appendLineString(
|
||||
new LineString([[5, 6], [7, 8]]));
|
||||
new LineString([[5, 6], [7, 8]]));
|
||||
expect(multiLineString.getCoordinates()).to.eql(
|
||||
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
|
||||
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('construct with 2D coordinates', function() {
|
||||
|
||||
var multiLineString;
|
||||
let multiLineString;
|
||||
beforeEach(function() {
|
||||
multiLineString = new MultiLineString(
|
||||
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
|
||||
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
|
||||
});
|
||||
|
||||
it('has the expected layout', function() {
|
||||
@@ -65,7 +65,7 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('has the expected coordinates', function() {
|
||||
expect(multiLineString.getCoordinates()).to.eql(
|
||||
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
|
||||
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
|
||||
});
|
||||
|
||||
it('has the expected extent', function() {
|
||||
@@ -74,7 +74,7 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('has the expected flat coordinates', function() {
|
||||
expect(multiLineString.getFlatCoordinates()).to.eql(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
});
|
||||
|
||||
it('has stride the expected stride', function() {
|
||||
@@ -105,10 +105,10 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
describe('construct with 3D coordinates', function() {
|
||||
|
||||
var multiLineString;
|
||||
let multiLineString;
|
||||
beforeEach(function() {
|
||||
multiLineString = new MultiLineString(
|
||||
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]);
|
||||
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]);
|
||||
});
|
||||
|
||||
it('has the expected layout', function() {
|
||||
@@ -117,7 +117,7 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('has the expected coordinates', function() {
|
||||
expect(multiLineString.getCoordinates()).to.eql(
|
||||
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]);
|
||||
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]);
|
||||
});
|
||||
|
||||
it('has the expected extent', function() {
|
||||
@@ -126,7 +126,7 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('has the expected flat coordinates', function() {
|
||||
expect(multiLineString.getFlatCoordinates()).to.eql(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
|
||||
});
|
||||
|
||||
it('has stride the expected stride', function() {
|
||||
@@ -137,11 +137,11 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
describe('construct with 3D coordinates and layout XYM', function() {
|
||||
|
||||
var multiLineString;
|
||||
let multiLineString;
|
||||
beforeEach(function() {
|
||||
multiLineString = new MultiLineString(
|
||||
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]],
|
||||
'XYM');
|
||||
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]],
|
||||
'XYM');
|
||||
});
|
||||
|
||||
it('has the expected layout', function() {
|
||||
@@ -150,7 +150,7 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('has the expected coordinates', function() {
|
||||
expect(multiLineString.getCoordinates()).to.eql(
|
||||
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]);
|
||||
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]);
|
||||
});
|
||||
|
||||
it('has the expected extent', function() {
|
||||
@@ -159,7 +159,7 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('has the expected flat coordinates', function() {
|
||||
expect(multiLineString.getFlatCoordinates()).to.eql(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
|
||||
});
|
||||
|
||||
it('has stride the expected stride', function() {
|
||||
@@ -167,11 +167,11 @@ describe('ol.geom.MultiLineString', function() {
|
||||
});
|
||||
|
||||
it('can return individual line strings', function() {
|
||||
var lineString0 = multiLineString.getLineString(0);
|
||||
const lineString0 = multiLineString.getLineString(0);
|
||||
expect(lineString0).to.be.an(LineString);
|
||||
expect(lineString0.getLayout()).to.be('XYM');
|
||||
expect(lineString0.getCoordinates()).to.eql([[1, 2, 3], [4, 5, 6]]);
|
||||
var lineString1 = multiLineString.getLineString(1);
|
||||
const lineString1 = multiLineString.getLineString(1);
|
||||
expect(lineString1).to.be.an(LineString);
|
||||
expect(lineString1.getLayout()).to.be('XYM');
|
||||
expect(lineString1.getCoordinates()).to.eql([[7, 8, 9], [10, 11, 12]]);
|
||||
@@ -183,23 +183,23 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('returns the expected value', function() {
|
||||
expect(multiLineString.getCoordinateAtM(0, true, true)).to.eql(
|
||||
[1, 2, 0]);
|
||||
[1, 2, 0]);
|
||||
expect(multiLineString.getCoordinateAtM(3, true, true)).to.eql(
|
||||
[1, 2, 3]);
|
||||
[1, 2, 3]);
|
||||
expect(multiLineString.getCoordinateAtM(4.5, true, true)).to.eql(
|
||||
[2.5, 3.5, 4.5]);
|
||||
[2.5, 3.5, 4.5]);
|
||||
expect(multiLineString.getCoordinateAtM(6, true, true)).to.eql(
|
||||
[4, 5, 6]);
|
||||
[4, 5, 6]);
|
||||
expect(multiLineString.getCoordinateAtM(7.5, true, true)).to.eql(
|
||||
[5.5, 6.5, 7.5]);
|
||||
[5.5, 6.5, 7.5]);
|
||||
expect(multiLineString.getCoordinateAtM(9, true, true)).to.eql(
|
||||
[7, 8, 9]);
|
||||
[7, 8, 9]);
|
||||
expect(multiLineString.getCoordinateAtM(10.5, true, true)).to.eql(
|
||||
[8.5, 9.5, 10.5]);
|
||||
[8.5, 9.5, 10.5]);
|
||||
expect(multiLineString.getCoordinateAtM(12, true, true)).to.eql(
|
||||
[10, 11, 12]);
|
||||
[10, 11, 12]);
|
||||
expect(multiLineString.getCoordinateAtM(15, true, true)).to.eql(
|
||||
[10, 11, 15]);
|
||||
[10, 11, 15]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -208,23 +208,23 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('returns the expected value', function() {
|
||||
expect(multiLineString.getCoordinateAtM(0, true, false)).to.eql(
|
||||
[1, 2, 0]);
|
||||
[1, 2, 0]);
|
||||
expect(multiLineString.getCoordinateAtM(3, true, false)).to.eql(
|
||||
[1, 2, 3]);
|
||||
[1, 2, 3]);
|
||||
expect(multiLineString.getCoordinateAtM(4.5, true, false)).to.eql(
|
||||
[2.5, 3.5, 4.5]);
|
||||
[2.5, 3.5, 4.5]);
|
||||
expect(multiLineString.getCoordinateAtM(6, true, false)).to.eql(
|
||||
[4, 5, 6]);
|
||||
[4, 5, 6]);
|
||||
expect(multiLineString.getCoordinateAtM(7.5, true, false)).to.be(
|
||||
null);
|
||||
null);
|
||||
expect(multiLineString.getCoordinateAtM(9, true, false)).to.eql(
|
||||
[7, 8, 9]);
|
||||
[7, 8, 9]);
|
||||
expect(multiLineString.getCoordinateAtM(10.5, true, false)).to.eql(
|
||||
[8.5, 9.5, 10.5]);
|
||||
[8.5, 9.5, 10.5]);
|
||||
expect(multiLineString.getCoordinateAtM(12, true, false)).to.eql(
|
||||
[10, 11, 12]);
|
||||
[10, 11, 12]);
|
||||
expect(multiLineString.getCoordinateAtM(15, true, false)).to.eql(
|
||||
[10, 11, 15]);
|
||||
[10, 11, 15]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -233,23 +233,23 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('returns the expected value', function() {
|
||||
expect(multiLineString.getCoordinateAtM(0, false, true)).to.eql(
|
||||
null);
|
||||
null);
|
||||
expect(multiLineString.getCoordinateAtM(3, false, true)).to.eql(
|
||||
[1, 2, 3]);
|
||||
[1, 2, 3]);
|
||||
expect(multiLineString.getCoordinateAtM(4.5, false, true)).to.eql(
|
||||
[2.5, 3.5, 4.5]);
|
||||
[2.5, 3.5, 4.5]);
|
||||
expect(multiLineString.getCoordinateAtM(6, false, true)).to.eql(
|
||||
[4, 5, 6]);
|
||||
[4, 5, 6]);
|
||||
expect(multiLineString.getCoordinateAtM(7.5, false, true)).to.eql(
|
||||
[5.5, 6.5, 7.5]);
|
||||
[5.5, 6.5, 7.5]);
|
||||
expect(multiLineString.getCoordinateAtM(9, false, true)).to.eql(
|
||||
[7, 8, 9]);
|
||||
[7, 8, 9]);
|
||||
expect(multiLineString.getCoordinateAtM(10.5, false, true)).to.eql(
|
||||
[8.5, 9.5, 10.5]);
|
||||
[8.5, 9.5, 10.5]);
|
||||
expect(multiLineString.getCoordinateAtM(12, false, true)).to.eql(
|
||||
[10, 11, 12]);
|
||||
[10, 11, 12]);
|
||||
expect(multiLineString.getCoordinateAtM(15, false, true)).to.eql(
|
||||
null);
|
||||
null);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -258,23 +258,23 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('returns the expected value', function() {
|
||||
expect(multiLineString.getCoordinateAtM(0, false, false)).to.eql(
|
||||
null);
|
||||
null);
|
||||
expect(multiLineString.getCoordinateAtM(3, false, false)).to.eql(
|
||||
[1, 2, 3]);
|
||||
[1, 2, 3]);
|
||||
expect(multiLineString.getCoordinateAtM(4.5, false, false)).to.eql(
|
||||
[2.5, 3.5, 4.5]);
|
||||
[2.5, 3.5, 4.5]);
|
||||
expect(multiLineString.getCoordinateAtM(6, false, false)).to.eql(
|
||||
[4, 5, 6]);
|
||||
[4, 5, 6]);
|
||||
expect(multiLineString.getCoordinateAtM(7.5, false, false)).to.eql(
|
||||
null);
|
||||
null);
|
||||
expect(multiLineString.getCoordinateAtM(9, false, false)).to.eql(
|
||||
[7, 8, 9]);
|
||||
[7, 8, 9]);
|
||||
expect(multiLineString.getCoordinateAtM(10.5, false, false)).to.eql(
|
||||
[8.5, 9.5, 10.5]);
|
||||
[8.5, 9.5, 10.5]);
|
||||
expect(multiLineString.getCoordinateAtM(12, false, false)).to.eql(
|
||||
[10, 11, 12]);
|
||||
[10, 11, 12]);
|
||||
expect(multiLineString.getCoordinateAtM(15, false, false)).to.eql(
|
||||
null);
|
||||
null);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -285,10 +285,10 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
describe('construct with 4D coordinates', function() {
|
||||
|
||||
var multiLineString;
|
||||
let multiLineString;
|
||||
beforeEach(function() {
|
||||
multiLineString = new MultiLineString(
|
||||
[[[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]]);
|
||||
[[[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]]);
|
||||
});
|
||||
|
||||
it('has the expected layout', function() {
|
||||
@@ -297,7 +297,7 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('has the expected coordinates', function() {
|
||||
expect(multiLineString.getCoordinates()).to.eql(
|
||||
[[[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]]);
|
||||
[[[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]]);
|
||||
});
|
||||
|
||||
it('has the expected extent', function() {
|
||||
@@ -306,7 +306,7 @@ describe('ol.geom.MultiLineString', function() {
|
||||
|
||||
it('has the expected flat coordinates', function() {
|
||||
expect(multiLineString.getFlatCoordinates()).to.eql(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
|
||||
});
|
||||
|
||||
it('has stride the expected stride', function() {
|
||||
@@ -318,23 +318,23 @@ describe('ol.geom.MultiLineString', function() {
|
||||
describe('#scale()', function() {
|
||||
|
||||
it('scales a multi-linestring', function() {
|
||||
var geom = new MultiLineString([[[-10, -20], [10, 20]], [[5, -10], [-5, 10]]]);
|
||||
const geom = new MultiLineString([[[-10, -20], [10, 20]], [[5, -10], [-5, 10]]]);
|
||||
geom.scale(10);
|
||||
var coordinates = geom.getCoordinates();
|
||||
const coordinates = geom.getCoordinates();
|
||||
expect(coordinates).to.eql([[[-100, -200], [100, 200]], [[50, -100], [-50, 100]]]);
|
||||
});
|
||||
|
||||
it('accepts sx and sy', function() {
|
||||
var geom = new MultiLineString([[[-10, -20], [10, 20]], [[5, -10], [-5, 10]]]);
|
||||
const geom = new MultiLineString([[[-10, -20], [10, 20]], [[5, -10], [-5, 10]]]);
|
||||
geom.scale(2, 3);
|
||||
var coordinates = geom.getCoordinates();
|
||||
const coordinates = geom.getCoordinates();
|
||||
expect(coordinates).to.eql([[[-20, -60], [20, 60]], [[10, -30], [-10, 30]]]);
|
||||
});
|
||||
|
||||
it('accepts an anchor', function() {
|
||||
var geom = new MultiLineString([[[-10, -20], [10, 20]], [[5, -10], [-5, 10]]]);
|
||||
const geom = new MultiLineString([[[-10, -20], [10, 20]], [[5, -10], [-5, 10]]]);
|
||||
geom.scale(3, 2, [10, 20]);
|
||||
var coordinates = geom.getCoordinates();
|
||||
const coordinates = geom.getCoordinates();
|
||||
expect(coordinates).to.eql([[[-50, -60], [10, 20]], [[-5, -40], [-35, 0]]]);
|
||||
});
|
||||
|
||||
@@ -343,14 +343,14 @@ describe('ol.geom.MultiLineString', function() {
|
||||
describe('#setLineStrings', function() {
|
||||
|
||||
it('sets the line strings', function() {
|
||||
var multiLineString = new MultiLineString(null);
|
||||
var lineString1 = new LineString([[1, 2], [3, 4]]);
|
||||
var lineString2 = new LineString([[5, 6], [7, 8]]);
|
||||
const multiLineString = new MultiLineString(null);
|
||||
const lineString1 = new LineString([[1, 2], [3, 4]]);
|
||||
const lineString2 = new LineString([[5, 6], [7, 8]]);
|
||||
multiLineString.setLineStrings([lineString1, lineString2]);
|
||||
expect(multiLineString.getFlatCoordinates()).to.eql(
|
||||
[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
expect(multiLineString.getEnds()).to.eql([4, 8]);
|
||||
var coordinates = multiLineString.getCoordinates();
|
||||
const coordinates = multiLineString.getCoordinates();
|
||||
expect(coordinates[0]).to.eql(lineString1.getCoordinates());
|
||||
expect(coordinates[1]).to.eql(lineString2.getCoordinates());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user