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,58 +1,69 @@
|
||||
import {matchingChunk} from '../../../../../src/ol/geom/flat/straightchunk.js';
|
||||
|
||||
|
||||
describe('ol.geom.flat.straightchunk', function() {
|
||||
|
||||
describe('ol.geom.flat.straightchunk.matchingChunk', function() {
|
||||
|
||||
describe('single segment with stride == 3', function() {
|
||||
describe('ol.geom.flat.straightchunk', function () {
|
||||
describe('ol.geom.flat.straightchunk.matchingChunk', function () {
|
||||
describe('single segment with stride == 3', function () {
|
||||
const flatCoords = [0, 0, 42, 1, 1, 42];
|
||||
const stride = 3;
|
||||
|
||||
it('returns whole line with angle delta', function() {
|
||||
it('returns whole line with angle delta', function () {
|
||||
const got = matchingChunk(Math.PI / 4, flatCoords, 0, 6, stride);
|
||||
expect(got).to.eql([0, 6]);
|
||||
});
|
||||
|
||||
it('returns whole line with zero angle delta', function() {
|
||||
it('returns whole line with zero angle delta', function () {
|
||||
const got = matchingChunk(0, flatCoords, 0, 6, stride);
|
||||
expect(got).to.eql([0, 6]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('short line string', function() {
|
||||
describe('short line string', function () {
|
||||
const flatCoords = [0, 0, 1, 0, 1, 1, 0, 1];
|
||||
const stride = 2;
|
||||
|
||||
it('returns whole line if straight enough', function() {
|
||||
it('returns whole line if straight enough', function () {
|
||||
const got = matchingChunk(Math.PI, flatCoords, 0, 8, stride);
|
||||
expect(got).to.eql([0, 8]);
|
||||
});
|
||||
|
||||
it('returns first matching chunk if all chunk lengths are the same', function() {
|
||||
it('returns first matching chunk if all chunk lengths are the same', function () {
|
||||
const got = matchingChunk(Math.PI / 4, flatCoords, 0, 8, stride);
|
||||
expect(got).to.eql([0, 4]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('longer line string', function() {
|
||||
const flatCoords = [0, 0, 1, 0, 1, 1, 0, 1, 0, -1, -1, -1, -1, 0, -1, 2, -2, 4];
|
||||
describe('longer line string', function () {
|
||||
const flatCoords = [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
0,
|
||||
-1,
|
||||
2,
|
||||
-2,
|
||||
4,
|
||||
];
|
||||
const stride = 2;
|
||||
|
||||
it('returns stright chunk from within the linestring', function() {
|
||||
it('returns stright chunk from within the linestring', function () {
|
||||
const got = matchingChunk(0, flatCoords, 0, 18, stride);
|
||||
expect(got).to.eql([10, 16]);
|
||||
});
|
||||
|
||||
it('returns long chunk at the end if angle and length within threshold', function() {
|
||||
it('returns long chunk at the end if angle and length within threshold', function () {
|
||||
const got = matchingChunk(Math.PI / 4, flatCoords, 0, 18, stride);
|
||||
expect(got).to.eql([10, 18]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user