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

View File

@@ -6,7 +6,7 @@ describe('ol.source.Source', function() {
describe('constructor', function() {
it('returns a source', function() {
var source = new Source({
const source = new Source({
projection: getProjection('EPSG:4326')
});
expect(source).to.be.a(Source);
@@ -15,50 +15,50 @@ describe('ol.source.Source', function() {
describe('config option `attributions`', function() {
it('accepts undefined', function() {
var source = new Source({});
var attributions = source.getAttributions();
const source = new Source({});
const attributions = source.getAttributions();
expect(attributions).to.be(null);
});
it('accepts a single string', function() {
var source = new Source({
const source = new Source({
attributions: 'Humpty'
});
var attributions = source.getAttributions();
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
expect(typeof attributions).to.be('function');
expect(attributions()).to.eql(['Humpty']);
});
it('accepts an array of strings', function() {
var source = new Source({
const source = new Source({
attributions: ['Humpty', 'Dumpty']
});
var attributions = source.getAttributions();
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
expect(typeof attributions).to.be('function');
expect(attributions()).to.eql(['Humpty', 'Dumpty']);
});
it('accepts a function that returns a string', function() {
var source = new Source({
const source = new Source({
attributions: function() {
return 'Humpty';
}
});
var attributions = source.getAttributions();
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
expect(typeof attributions).to.be('function');
expect(attributions()).to.be('Humpty');
});
it('accepts a function that returns an array of strings', function() {
var source = new Source({
const source = new Source({
attributions: function() {
return ['Humpty', 'Dumpty'];
}
});
var attributions = source.getAttributions();
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
expect(typeof attributions).to.be('function');
expect(attributions()).to.eql(['Humpty', 'Dumpty']);
@@ -67,10 +67,10 @@ describe('ol.source.Source', function() {
describe('#refresh()', function() {
it('dispatches the change event', function() {
var source = new Source({
const source = new Source({
projection: getProjection('EPSG:4326')
});
var changedSpy = sinon.spy();
const changedSpy = sinon.spy();
source.on('change', changedSpy);
source.refresh();
expect(changedSpy.called).to.be.ok();
@@ -78,7 +78,7 @@ describe('ol.source.Source', function() {
});
describe('#setAttributions()', function() {
var source = null;
let source = null;
beforeEach(function() {
source = new Source({
@@ -92,13 +92,13 @@ describe('ol.source.Source', function() {
it('accepts undefined', function() {
source.setAttributions();
var attributions = source.getAttributions();
const attributions = source.getAttributions();
expect(attributions).to.be(null);
});
it('accepts a single string', function() {
source.setAttributions('Humpty');
var attributions = source.getAttributions();
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
expect(typeof attributions).to.be('function');
expect(attributions()).to.eql(['Humpty']);
@@ -106,7 +106,7 @@ describe('ol.source.Source', function() {
it('accepts an array of strings', function() {
source.setAttributions(['Humpty', 'Dumpty']);
var attributions = source.getAttributions();
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
expect(typeof attributions).to.be('function');
expect(attributions()).to.eql(['Humpty', 'Dumpty']);
@@ -116,7 +116,7 @@ describe('ol.source.Source', function() {
source.setAttributions(function() {
return 'Humpty';
});
var attributions = source.getAttributions();
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
expect(typeof attributions).to.be('function');
expect(attributions()).to.eql('Humpty');
@@ -126,7 +126,7 @@ describe('ol.source.Source', function() {
source.setAttributions(function() {
return ['Humpty', 'Dumpty'];
});
var attributions = source.getAttributions();
const attributions = source.getAttributions();
expect(attributions).to.not.be(null);
expect(typeof attributions).to.be('function');
expect(attributions()).to.eql(['Humpty', 'Dumpty']);