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:
@@ -10,14 +10,14 @@ import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||
|
||||
describe('ol.interaction.DragZoom', function() {
|
||||
|
||||
var target, map, source;
|
||||
let target, map, source;
|
||||
|
||||
var width = 360;
|
||||
var height = 180;
|
||||
const width = 360;
|
||||
const height = 180;
|
||||
|
||||
beforeEach(function(done) {
|
||||
target = document.createElement('div');
|
||||
var style = target.style;
|
||||
const style = target.style;
|
||||
style.position = 'absolute';
|
||||
style.left = '-1000px';
|
||||
style.top = '-1000px';
|
||||
@@ -25,7 +25,7 @@ describe('ol.interaction.DragZoom', function() {
|
||||
style.height = height + 'px';
|
||||
document.body.appendChild(target);
|
||||
source = new VectorSource();
|
||||
var layer = new VectorLayer({source: source});
|
||||
const layer = new VectorLayer({source: source});
|
||||
map = new Map({
|
||||
target: target,
|
||||
layers: [layer],
|
||||
@@ -48,15 +48,15 @@ describe('ol.interaction.DragZoom', function() {
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new DragZoom();
|
||||
const instance = new DragZoom();
|
||||
expect(instance).to.be.an(DragZoom);
|
||||
});
|
||||
it('sets "ol-dragzoom" as box className', function() {
|
||||
var instance = new DragZoom();
|
||||
const instance = new DragZoom();
|
||||
expect(instance.box_.element_.className).to.be('ol-box ol-dragzoom');
|
||||
});
|
||||
it('sets a custom box className', function() {
|
||||
var instance = new DragZoom({className: 'test-dragzoom'});
|
||||
const instance = new DragZoom({className: 'test-dragzoom'});
|
||||
expect(instance.box_.element_.className).to.be('ol-box test-dragzoom');
|
||||
});
|
||||
|
||||
@@ -65,20 +65,20 @@ describe('ol.interaction.DragZoom', function() {
|
||||
describe('#onBoxEnd()', function() {
|
||||
|
||||
it('centers the view on the box geometry', function(done) {
|
||||
var interaction = new DragZoom({
|
||||
const interaction = new DragZoom({
|
||||
duration: 10
|
||||
});
|
||||
map.addInteraction(interaction);
|
||||
|
||||
var box = new _ol_render_Box_();
|
||||
var extent = [-110, 40, -90, 60];
|
||||
const box = new _ol_render_Box_();
|
||||
const extent = [-110, 40, -90, 60];
|
||||
box.geometry_ = polygonFromExtent(extent);
|
||||
interaction.box_ = box;
|
||||
|
||||
interaction.onBoxEnd();
|
||||
setTimeout(function() {
|
||||
var view = map.getView();
|
||||
var center = view.getCenter();
|
||||
const view = map.getView();
|
||||
const center = view.getCenter();
|
||||
expect(center).to.eql(_ol_extent_.getCenter(extent));
|
||||
done();
|
||||
}, 50);
|
||||
@@ -86,14 +86,14 @@ describe('ol.interaction.DragZoom', function() {
|
||||
});
|
||||
|
||||
it('sets new resolution while zooming out', function(done) {
|
||||
var interaction = new DragZoom({
|
||||
const interaction = new DragZoom({
|
||||
duration: 10,
|
||||
out: true
|
||||
});
|
||||
map.addInteraction(interaction);
|
||||
|
||||
var box = new _ol_render_Box_();
|
||||
var extent = [-11.25, -11.25, 11.25, 11.25];
|
||||
const box = new _ol_render_Box_();
|
||||
const extent = [-11.25, -11.25, 11.25, 11.25];
|
||||
box.geometry_ = polygonFromExtent(extent);
|
||||
interaction.box_ = box;
|
||||
|
||||
@@ -101,8 +101,8 @@ describe('ol.interaction.DragZoom', function() {
|
||||
setTimeout(function() {
|
||||
interaction.onBoxEnd();
|
||||
setTimeout(function() {
|
||||
var view = map.getView();
|
||||
var resolution = view.getResolution();
|
||||
const view = map.getView();
|
||||
const resolution = view.getResolution();
|
||||
expect(resolution).to.eql(view.constrainResolution(0.5));
|
||||
done();
|
||||
}, 50);
|
||||
|
||||
Reference in New Issue
Block a user