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
+34 -34
View File
@@ -9,16 +9,16 @@ import Text from '../../../../src/ol/style/Text.js';
describe('ol.style.Style', function() {
var testFill = new Fill({
const testFill = new Fill({
color: 'rgba(255, 255, 255, 0.6)'
});
var testStroke = new Stroke({
const testStroke = new Stroke({
color: '#319FD3',
width: 1
});
var testText = new Text({
const testText = new Text({
font: '12px Calibri,sans-serif',
fill: new Fill({
color: '#000'
@@ -29,21 +29,21 @@ describe('ol.style.Style', function() {
})
});
var testImage = new CircleStyle({
const testImage = new CircleStyle({
radius: 5
});
describe('#clone', function() {
it('creates a new ol.style.Style', function() {
var original = new Style();
var clone = original.clone();
const original = new Style();
const clone = original.clone();
expect(clone).to.be.an(Style);
expect(clone).to.not.be(original);
});
it('copies all values', function() {
var original = new Style({
const original = new Style({
geometry: new Point([0, 0, 0]),
fill: new Fill({
color: '#319FD3'
@@ -59,7 +59,7 @@ describe('ol.style.Style', function() {
}),
zIndex: 2
});
var clone = original.clone();
const clone = original.clone();
expect(original.getGeometry().getCoordinates()).to.eql(clone.getGeometry().getCoordinates());
expect(original.getFill().getColor()).to.eql(clone.getFill().getColor());
expect(original.getImage().getRadius()).to.eql(clone.getImage().getRadius());
@@ -69,7 +69,7 @@ describe('ol.style.Style', function() {
});
it('the clone does not reference the same objects as the original', function() {
var original = new Style({
const original = new Style({
geometry: new Point([0, 0, 0]),
fill: new Fill({
color: '#319FD3'
@@ -84,7 +84,7 @@ describe('ol.style.Style', function() {
text: 'test'
})
});
var clone = original.clone();
const clone = original.clone();
expect(original.getGeometry()).not.to.be(clone.getGeometry());
expect(original.getFill()).not.to.be(clone.getFill());
expect(original.getImage()).not.to.be(clone.getImage());
@@ -107,7 +107,7 @@ describe('ol.style.Style', function() {
describe('#setZIndex', function() {
it('sets the zIndex', function() {
var style = new Style();
const style = new Style();
style.setZIndex(0.7);
expect(style.getZIndex()).to.be(0.7);
@@ -115,7 +115,7 @@ describe('ol.style.Style', function() {
});
describe('#getFill', function() {
var style = new Style({
const style = new Style({
fill: testFill
});
@@ -125,7 +125,7 @@ describe('ol.style.Style', function() {
});
describe('#setFill', function() {
var style = new Style();
const style = new Style();
it('sets the fill style of a style', function() {
style.setFill(testFill);
@@ -134,7 +134,7 @@ describe('ol.style.Style', function() {
});
describe('#getImage', function() {
var style = new Style({
const style = new Style({
image: testImage
});
@@ -144,7 +144,7 @@ describe('ol.style.Style', function() {
});
describe('#setImage', function() {
var style = new Style();
const style = new Style();
it('sets the image style of a style', function() {
style.setImage(testImage);
@@ -153,7 +153,7 @@ describe('ol.style.Style', function() {
});
describe('#getStroke', function() {
var style = new Style({
const style = new Style({
stroke: testStroke
});
@@ -163,7 +163,7 @@ describe('ol.style.Style', function() {
});
describe('#setStroke', function() {
var style = new Style();
const style = new Style();
it('sets the stroke style of a style', function() {
style.setStroke(testStroke);
@@ -172,7 +172,7 @@ describe('ol.style.Style', function() {
});
describe('#getText', function() {
var style = new Style({
const style = new Style({
text: testText
});
@@ -182,7 +182,7 @@ describe('ol.style.Style', function() {
});
describe('#setText', function() {
var style = new Style();
const style = new Style();
it('sets the text style of a style', function() {
style.setText(testText);
@@ -191,43 +191,43 @@ describe('ol.style.Style', function() {
});
describe('#setGeometry', function() {
var style = new Style();
const style = new Style();
it('creates a geometry function from a string', function() {
var feature = new Feature();
const feature = new Feature();
feature.set('myGeom', new Point([0, 0]));
style.setGeometry('myGeom');
expect(style.getGeometryFunction()(feature))
.to.eql(feature.get('myGeom'));
.to.eql(feature.get('myGeom'));
});
it('creates a geometry function from a geometry', function() {
var geom = new Point([0, 0]);
const geom = new Point([0, 0]);
style.setGeometry(geom);
expect(style.getGeometryFunction()())
.to.eql(geom);
.to.eql(geom);
});
it('returns the configured geometry function', function() {
var geom = new Point([0, 0]);
const geom = new Point([0, 0]);
style.setGeometry(function() {
return geom;
});
expect(style.getGeometryFunction()())
.to.eql(geom);
.to.eql(geom);
});
});
describe('#getGeometry', function() {
it('returns whatever was passed to setGeometry', function() {
var style = new Style();
const style = new Style();
style.setGeometry('foo');
expect(style.getGeometry()).to.eql('foo');
var geom = new Point([1, 2]);
const geom = new Point([1, 2]);
style.setGeometry(geom);
expect(style.getGeometry()).to.eql(geom);
var fn = function() {
const fn = function() {
return geom;
};
style.setGeometry(fn);
@@ -241,23 +241,23 @@ describe('ol.style.Style', function() {
});
describe('ol.style.Style.createFunction()', function() {
var style = new Style();
const style = new Style();
it('creates a style function from a single style', function() {
var styleFunction = Style.createFunction(style);
const styleFunction = Style.createFunction(style);
expect(styleFunction()).to.eql([style]);
});
it('creates a style function from an array of styles', function() {
var styleFunction = Style.createFunction([style]);
const styleFunction = Style.createFunction([style]);
expect(styleFunction()).to.eql([style]);
});
it('passes through a function', function() {
var original = function() {
const original = function() {
return [style];
};
var styleFunction = Style.createFunction(original);
const styleFunction = Style.createFunction(original);
expect(styleFunction).to.be(original);
});