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,80 +1,67 @@
|
||||
import {interpolatePoint} from '../../../../../src/ol/geom/flat/interpolate.js';
|
||||
|
||||
|
||||
describe('ol.geom.flat.interpolate', function() {
|
||||
|
||||
describe('ol.geom.flat.interpolate.interpolatePoint', function() {
|
||||
|
||||
it('returns the expected value for single points', function() {
|
||||
describe('ol.geom.flat.interpolate', function () {
|
||||
describe('ol.geom.flat.interpolate.interpolatePoint', function () {
|
||||
it('returns the expected value for single points', function () {
|
||||
const flatCoordinates = [0, 1];
|
||||
const point =
|
||||
interpolatePoint(flatCoordinates, 0, 2, 2, 0.5);
|
||||
const point = interpolatePoint(flatCoordinates, 0, 2, 2, 0.5);
|
||||
expect(point).to.eql([0, 1]);
|
||||
});
|
||||
|
||||
it('returns the expected value for simple line segments', function() {
|
||||
it('returns the expected value for simple line segments', function () {
|
||||
const flatCoordinates = [0, 1, 2, 3];
|
||||
const point =
|
||||
interpolatePoint(flatCoordinates, 0, 4, 2, 0.5);
|
||||
const point = interpolatePoint(flatCoordinates, 0, 4, 2, 0.5);
|
||||
expect(point).to.eql([1, 2]);
|
||||
});
|
||||
|
||||
it('returns the expected value when the mid point is an existing ' +
|
||||
it(
|
||||
'returns the expected value when the mid point is an existing ' +
|
||||
'coordinate',
|
||||
function() {
|
||||
const flatCoordinates = [0, 1, 2, 3, 4, 5];
|
||||
const point = interpolatePoint(
|
||||
flatCoordinates, 0, 6, 2, 0.5);
|
||||
expect(point).to.eql([2, 3]);
|
||||
});
|
||||
function () {
|
||||
const flatCoordinates = [0, 1, 2, 3, 4, 5];
|
||||
const point = interpolatePoint(flatCoordinates, 0, 6, 2, 0.5);
|
||||
expect(point).to.eql([2, 3]);
|
||||
}
|
||||
);
|
||||
|
||||
it('also when vertices are repeated', function() {
|
||||
it('also when vertices are repeated', function () {
|
||||
const flatCoordinates = [0, 1, 2, 3, 2, 3, 4, 5];
|
||||
const point = interpolatePoint(
|
||||
flatCoordinates, 0, 8, 2, 0.5);
|
||||
const point = interpolatePoint(flatCoordinates, 0, 8, 2, 0.5);
|
||||
expect(point).to.eql([2, 3]);
|
||||
});
|
||||
|
||||
it('returns the expected value when the midpoint falls halfway between ' +
|
||||
it(
|
||||
'returns the expected value when the midpoint falls halfway between ' +
|
||||
'two existing coordinates',
|
||||
function() {
|
||||
const flatCoordinates = [0, 1, 2, 3, 4, 5, 6, 7];
|
||||
const point = interpolatePoint(
|
||||
flatCoordinates, 0, 8, 2, 0.5);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
function () {
|
||||
const flatCoordinates = [0, 1, 2, 3, 4, 5, 6, 7];
|
||||
const point = interpolatePoint(flatCoordinates, 0, 8, 2, 0.5);
|
||||
expect(point).to.eql([3, 4]);
|
||||
}
|
||||
);
|
||||
|
||||
it('also when vertices are repeated', function() {
|
||||
it('also when vertices are repeated', function () {
|
||||
const flatCoordinates = [0, 1, 2, 3, 2, 3, 4, 5, 6, 7];
|
||||
const point = interpolatePoint(
|
||||
flatCoordinates, 0, 10, 2, 0.5);
|
||||
const point = interpolatePoint(flatCoordinates, 0, 10, 2, 0.5);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
|
||||
it('returns the expected value when the coordinates are not evenly spaced',
|
||||
function() {
|
||||
const flatCoordinates = [0, 1, 2, 3, 6, 7];
|
||||
const point = interpolatePoint(
|
||||
flatCoordinates, 0, 6, 2, 0.5);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
it('returns the expected value when the coordinates are not evenly spaced', function () {
|
||||
const flatCoordinates = [0, 1, 2, 3, 6, 7];
|
||||
const point = interpolatePoint(flatCoordinates, 0, 6, 2, 0.5);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
|
||||
it('also when vertices are repeated',
|
||||
function() {
|
||||
const flatCoordinates = [0, 1, 2, 3, 2, 3, 6, 7];
|
||||
const point = interpolatePoint(
|
||||
flatCoordinates, 0, 8, 2, 0.5);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
|
||||
it('returns the expected value when using opt_dest',
|
||||
function() {
|
||||
const flatCoordinates = [0, 1, 2, 3, 6, 7];
|
||||
const point = interpolatePoint(
|
||||
flatCoordinates, 0, 6, 2, 0.5, [0, 0]);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
it('also when vertices are repeated', function () {
|
||||
const flatCoordinates = [0, 1, 2, 3, 2, 3, 6, 7];
|
||||
const point = interpolatePoint(flatCoordinates, 0, 8, 2, 0.5);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
|
||||
it('returns the expected value when using opt_dest', function () {
|
||||
const flatCoordinates = [0, 1, 2, 3, 6, 7];
|
||||
const point = interpolatePoint(flatCoordinates, 0, 6, 2, 0.5, [0, 0]);
|
||||
expect(point).to.eql([3, 4]);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user