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:
@@ -4,30 +4,30 @@ describe('ol.events.Event', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
it('takes a type as argument', function() {
|
||||
var event = new Event('foo');
|
||||
const event = new Event('foo');
|
||||
expect(event.type).to.be('foo');
|
||||
});
|
||||
it('does not set the propagationStopped flag', function() {
|
||||
var event = new Event('foo');
|
||||
const event = new Event('foo');
|
||||
expect(event.propagationStopped).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#preventDefault', function() {
|
||||
it('sets the propagationStopped flag', function() {
|
||||
var event = new Event('foo');
|
||||
const event = new Event('foo');
|
||||
event.preventDefault();
|
||||
expect(event.propagationStopped).to.be(true);
|
||||
});
|
||||
it('is the same as #stopPropagation', function() {
|
||||
var event = new Event('foo');
|
||||
const event = new Event('foo');
|
||||
expect(event.stopPropagation).to.equal(event.preventDefault);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ol.events.Event.preventDefault', function() {
|
||||
it('calls preventDefault on the event object', function() {
|
||||
var event = {
|
||||
const event = {
|
||||
preventDefault: sinon.spy()
|
||||
};
|
||||
Event.preventDefault(event);
|
||||
@@ -37,7 +37,7 @@ describe('ol.events.Event', function() {
|
||||
|
||||
describe('ol.events.Event.stopPropagation', function() {
|
||||
it('calls preventDefault on the event object', function() {
|
||||
var event = {
|
||||
const event = {
|
||||
stopPropagation: sinon.spy()
|
||||
};
|
||||
Event.stopPropagation(event);
|
||||
|
||||
@@ -5,7 +5,7 @@ import EventTarget from '../../../../src/ol/events/EventTarget.js';
|
||||
|
||||
|
||||
describe('ol.events.EventTarget', function() {
|
||||
var called, events, eventTarget, spy1, spy2, spy3;
|
||||
let called, events, eventTarget, spy1, spy2, spy3;
|
||||
|
||||
beforeEach(function() {
|
||||
called = [];
|
||||
@@ -46,7 +46,7 @@ describe('ol.events.EventTarget', function() {
|
||||
describe('#getListeners', function() {
|
||||
it('returns listeners for a type or undefined if none', function() {
|
||||
expect(eventTarget.getListeners('foo')).to.be(undefined);
|
||||
var listeners = [function() {}];
|
||||
const listeners = [function() {}];
|
||||
eventTarget.listeners_['foo'] = listeners;
|
||||
expect(eventTarget.getListeners('foo')).to.equal(listeners);
|
||||
});
|
||||
@@ -111,7 +111,7 @@ describe('ol.events.EventTarget', function() {
|
||||
});
|
||||
it('passes a custom event object with target to listeners', function() {
|
||||
eventTarget.addEventListener('foo', spy1);
|
||||
var event = {
|
||||
const event = {
|
||||
type: 'foo'
|
||||
};
|
||||
eventTarget.dispatchEvent(event);
|
||||
|
||||
Reference in New Issue
Block a user