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:
@@ -2,13 +2,13 @@ import Map from '../../../../src/ol/Map.js';
|
||||
import Control from '../../../../src/ol/control/Control.js';
|
||||
|
||||
describe('ol.control.Control', function() {
|
||||
var map, control;
|
||||
let map, control;
|
||||
|
||||
beforeEach(function() {
|
||||
map = new Map({
|
||||
target: document.createElement('div')
|
||||
});
|
||||
var element = document.createElement('DIV');
|
||||
const element = document.createElement('DIV');
|
||||
control = new Control({element: element});
|
||||
control.setMap(map);
|
||||
});
|
||||
@@ -30,25 +30,25 @@ describe('ol.control.Control', function() {
|
||||
describe('ol.control.Control\'s target', function() {
|
||||
describe('target as string or element', function() {
|
||||
it('transforms target from string to element', function() {
|
||||
var target = document.createElement('div');
|
||||
const target = document.createElement('div');
|
||||
target.id = 'mycontrol';
|
||||
document.body.appendChild(target);
|
||||
var ctrl = new Control({target: 'mycontrol'});
|
||||
const ctrl = new Control({target: 'mycontrol'});
|
||||
expect(ctrl.target_.id).to.equal('mycontrol');
|
||||
ctrl.dispose();
|
||||
target.parentNode.removeChild(target);
|
||||
});
|
||||
it('accepts element for target', function() {
|
||||
var target = document.createElement('div');
|
||||
const target = document.createElement('div');
|
||||
target.id = 'mycontrol';
|
||||
document.body.appendChild(target);
|
||||
var ctrl = new Control({target: target});
|
||||
const ctrl = new Control({target: target});
|
||||
expect(ctrl.target_.id).to.equal('mycontrol');
|
||||
ctrl.dispose();
|
||||
target.parentNode.removeChild(target);
|
||||
});
|
||||
it('ignores non-existing target id', function() {
|
||||
var ctrl = new Control({target: 'doesnotexist'});
|
||||
const ctrl = new Control({target: 'doesnotexist'});
|
||||
expect(ctrl.target_).to.equal(null);
|
||||
ctrl.dispose();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user