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:
@@ -1,9 +1,9 @@
|
||||
import LinkedList from '../../../../src/ol/structs/LinkedList.js';
|
||||
|
||||
describe('ol.structs.LinkedList', function() {
|
||||
var ll;
|
||||
var item = {};
|
||||
var item2 = {};
|
||||
let ll;
|
||||
const item = {};
|
||||
const item2 = {};
|
||||
beforeEach(function() {
|
||||
ll = new LinkedList();
|
||||
});
|
||||
@@ -40,7 +40,7 @@ describe('ol.structs.LinkedList', function() {
|
||||
});
|
||||
|
||||
describe('#removeItem', function() {
|
||||
var item3 = {};
|
||||
const item3 = {};
|
||||
beforeEach(function() {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
@@ -82,13 +82,13 @@ describe('ol.structs.LinkedList', function() {
|
||||
it('sets the cursor to the first item and returns its data', function() {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
var i = ll.firstItem();
|
||||
const i = ll.firstItem();
|
||||
expect(i).to.be(item);
|
||||
expect(ll.head_.data).to.be(item);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
var i = ll.firstItem();
|
||||
const i = ll.firstItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
@@ -98,13 +98,13 @@ describe('ol.structs.LinkedList', function() {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
ll.firstItem();
|
||||
var i = ll.lastItem();
|
||||
const i = ll.lastItem();
|
||||
expect(i).to.be(item2);
|
||||
expect(ll.head_.data).to.be(item2);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
var i = ll.lastItem();
|
||||
const i = ll.lastItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
@@ -114,13 +114,13 @@ describe('ol.structs.LinkedList', function() {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
ll.firstItem();
|
||||
var i = ll.nextItem();
|
||||
const i = ll.nextItem();
|
||||
expect(i).to.be(item2);
|
||||
expect(ll.head_.data).to.be(item2);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
var i = ll.nextItem();
|
||||
const i = ll.nextItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
@@ -129,13 +129,13 @@ describe('ol.structs.LinkedList', function() {
|
||||
it('sets the cursor to the previous item and returns its data', function() {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
var i = ll.prevItem();
|
||||
const i = ll.prevItem();
|
||||
expect(i).to.be(item);
|
||||
expect(ll.head_.data).to.be(item);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
var i = ll.prevItem();
|
||||
const i = ll.prevItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
@@ -145,13 +145,13 @@ describe('ol.structs.LinkedList', function() {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
ll.firstItem();
|
||||
var i = ll.getNextItem();
|
||||
const i = ll.getNextItem();
|
||||
expect(i).to.be(item2);
|
||||
expect(ll.head_.data).to.be(item);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
var i = ll.getNextItem();
|
||||
const i = ll.getNextItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
@@ -160,31 +160,31 @@ describe('ol.structs.LinkedList', function() {
|
||||
it('returns the data of the previous item without stepping the cursor', function() {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
var i = ll.getPrevItem();
|
||||
const i = ll.getPrevItem();
|
||||
expect(i).to.be(item);
|
||||
expect(ll.head_.data).to.be(item2);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
var i = ll.getPrevItem();
|
||||
const i = ll.getPrevItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getCurrItem', function() {
|
||||
it('returns the data of the current item', function() {
|
||||
var item3 = {};
|
||||
const item3 = {};
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
ll.insertItem(item3);
|
||||
ll.prevItem();
|
||||
var i = ll.getCurrItem();
|
||||
const i = ll.getCurrItem();
|
||||
expect(i).to.be(item2);
|
||||
expect(ll.head_.data).to.be(item2);
|
||||
});
|
||||
|
||||
it('returns undefined on empty list', function() {
|
||||
var i = ll.getCurrItem();
|
||||
const i = ll.getCurrItem();
|
||||
expect(i).to.be(undefined);
|
||||
});
|
||||
});
|
||||
@@ -193,13 +193,13 @@ describe('ol.structs.LinkedList', function() {
|
||||
it('returns the length of the list', function() {
|
||||
ll.insertItem(item);
|
||||
ll.insertItem(item2);
|
||||
var l = ll.getLength();
|
||||
const l = ll.getLength();
|
||||
expect(l).to.be(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#concat', function() {
|
||||
var ll2, item3;
|
||||
let ll2, item3;
|
||||
beforeEach(function() {
|
||||
item3 = {};
|
||||
ll2 = new LinkedList();
|
||||
@@ -209,9 +209,9 @@ describe('ol.structs.LinkedList', function() {
|
||||
});
|
||||
|
||||
it('concatenates a second list with the current one', function() {
|
||||
var item4 = {};
|
||||
var item5 = {};
|
||||
var item6 = {};
|
||||
const item4 = {};
|
||||
const item5 = {};
|
||||
const item6 = {};
|
||||
ll.insertItem(item4);
|
||||
ll.insertItem(item5);
|
||||
ll.insertItem(item6);
|
||||
|
||||
Reference in New Issue
Block a user