Make code prettier
This updates ESLint and our shared eslint-config-openlayers to use Prettier. Most formatting changes were automatically applied with this:
npm run lint -- --fix
A few manual changes were required:
* In `examples/offscreen-canvas.js`, the `//eslint-disable-line` comment needed to be moved to the appropriate line to disable the error about the `'worker-loader!./offscreen-canvas.worker.js'` import.
* In `examples/webpack/exapmle-builder.js`, spaces could not be added after a couple `function`s for some reason. While editing this, I reworked `ExampleBuilder` to be a class.
* In `src/ol/format/WMSGetFeatureInfo.js`, the `// @ts-ignore` comment needed to be moved down one line so it applied to the `parsersNS` argument.
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import ExtentInteraction from '../../../../src/ol/interaction/Extent.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import View from '../../../../src/ol/View.js';
|
||||
import ExtentInteraction from '../../../../src/ol/interaction/Extent.js';
|
||||
|
||||
describe('ol.interaction.Extent', function() {
|
||||
describe('ol.interaction.Extent', function () {
|
||||
let map, interaction;
|
||||
|
||||
const width = 360;
|
||||
const height = 180;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
const target = createMapDiv(width, height);
|
||||
|
||||
map = new Map({
|
||||
@@ -18,8 +18,8 @@ describe('ol.interaction.Extent', function() {
|
||||
view: new View({
|
||||
projection: 'EPSG:4326',
|
||||
center: [0, 0],
|
||||
resolution: 1
|
||||
})
|
||||
resolution: 1,
|
||||
}),
|
||||
});
|
||||
map.renderSync();
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('ol.interaction.Extent', function() {
|
||||
map.addInteraction(interaction);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
if (map) {
|
||||
disposeMap(map);
|
||||
}
|
||||
@@ -57,33 +57,31 @@ describe('ol.interaction.Extent', function() {
|
||||
pointerEvent.clientY = position.top - y + height / 2;
|
||||
pointerEvent.shiftKey = shiftKey;
|
||||
pointerEvent.pointerId = 0;
|
||||
pointerEvent.preventDefault = function() {};
|
||||
pointerEvent.preventDefault = function () {};
|
||||
const event = new MapBrowserPointerEvent(type, map, pointerEvent);
|
||||
event.pointerEvent.pointerId = 1;
|
||||
map.handleMapBrowserEvent(event);
|
||||
}
|
||||
|
||||
describe('Constructor', function() {
|
||||
|
||||
it('can be configured with an extent', function() {
|
||||
expect(function() {
|
||||
describe('Constructor', function () {
|
||||
it('can be configured with an extent', function () {
|
||||
expect(function () {
|
||||
new ExtentInteraction({
|
||||
extent: [-10, -10, 10, 10]
|
||||
extent: [-10, -10, 10, 10],
|
||||
});
|
||||
}).to.not.throwException();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('snap to vertex', function() {
|
||||
it('snap to vertex works', function() {
|
||||
describe('snap to vertex', function () {
|
||||
it('snap to vertex works', function () {
|
||||
interaction.setExtent([-50, -50, 50, 50]);
|
||||
|
||||
expect(interaction.snapToVertex_([230, 40], map)).to.eql([50, 50]);
|
||||
expect(interaction.snapToVertex_([231, 41], map)).to.eql([50, 50]);
|
||||
});
|
||||
|
||||
it('snap to edge works', function() {
|
||||
it('snap to edge works', function () {
|
||||
interaction.setExtent([-50, -50, 50, 50]);
|
||||
|
||||
expect(interaction.snapToVertex_([230, 90], map)).to.eql([50, 0]);
|
||||
@@ -92,9 +90,8 @@ describe('ol.interaction.Extent', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('draw extent', function() {
|
||||
|
||||
it('drawing extent works', function() {
|
||||
describe('draw extent', function () {
|
||||
it('drawing extent works', function () {
|
||||
simulateEvent('pointerdown', -50, -50, false, 0);
|
||||
simulateEvent('pointerdrag', 50, 50, false, 0);
|
||||
simulateEvent('pointerup', 50, 50, false, 0);
|
||||
@@ -102,7 +99,7 @@ describe('ol.interaction.Extent', function() {
|
||||
expect(interaction.getExtent()).to.eql([-50, -50, 50, 50]);
|
||||
});
|
||||
|
||||
it('clicking off extent nulls extent', function() {
|
||||
it('clicking off extent nulls extent', function () {
|
||||
interaction.setExtent([-50, -50, 50, 50]);
|
||||
|
||||
simulateEvent('pointerdown', -10, -10, false, 0);
|
||||
@@ -111,7 +108,7 @@ describe('ol.interaction.Extent', function() {
|
||||
expect(interaction.getExtent()).to.equal(null);
|
||||
});
|
||||
|
||||
it('clicking on extent does not null extent', function() {
|
||||
it('clicking on extent does not null extent', function () {
|
||||
interaction.setExtent([-50, -50, 50, 50]);
|
||||
|
||||
simulateEvent('pointerdown', 50, 50, false, 0);
|
||||
@@ -120,7 +117,7 @@ describe('ol.interaction.Extent', function() {
|
||||
expect(interaction.getExtent()).to.eql([-50, -50, 50, 50]);
|
||||
});
|
||||
|
||||
it('snap and drag vertex works', function() {
|
||||
it('snap and drag vertex works', function () {
|
||||
interaction.setExtent([-50, -50, 50, 50]);
|
||||
|
||||
simulateEvent('pointerdown', 51, 49, false, 0);
|
||||
@@ -130,7 +127,7 @@ describe('ol.interaction.Extent', function() {
|
||||
expect(interaction.getExtent()).to.eql([-70, -50, -50, -40]);
|
||||
});
|
||||
|
||||
it('snap and drag edge works', function() {
|
||||
it('snap and drag edge works', function () {
|
||||
interaction.setExtent([-50, -50, 50, 50]);
|
||||
|
||||
simulateEvent('pointerdown', 51, 5, false, 0);
|
||||
|
||||
Reference in New Issue
Block a user