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.
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
import {lineStringIsClosed} from '../../../../../src/ol/geom/flat/topology.js';
|
|
|
|
describe('ol.geom.flat.topology', function () {
|
|
describe('ol.geom.flat.topology.lineStringIsClosed', function () {
|
|
it('identifies closed lines aka boundaries', function () {
|
|
const flatCoordinates = [0, 0, 3, 0, 0, 3, 0, 0];
|
|
const isClosed = lineStringIsClosed(
|
|
flatCoordinates,
|
|
0,
|
|
flatCoordinates.length,
|
|
2
|
|
);
|
|
expect(isClosed).to.be(true);
|
|
});
|
|
|
|
it('identifies regular linestrings', function () {
|
|
const flatCoordinates = [0, 0, 3, 0, 0, 3, 5, 2];
|
|
const isClosed = lineStringIsClosed(
|
|
flatCoordinates,
|
|
0,
|
|
flatCoordinates.length,
|
|
2
|
|
);
|
|
expect(isClosed).to.be(false);
|
|
});
|
|
|
|
it('identifies degenerate boundaries', function () {
|
|
let flatCoordinates = [0, 0, 3, 0, 0, 0];
|
|
let isClosed = lineStringIsClosed(
|
|
flatCoordinates,
|
|
0,
|
|
flatCoordinates.length,
|
|
2
|
|
);
|
|
expect(isClosed).to.be(false);
|
|
|
|
flatCoordinates = [0, 0, 1, 1, 3, 3, 5, 5, 0, 0];
|
|
isClosed = lineStringIsClosed(
|
|
flatCoordinates,
|
|
0,
|
|
flatCoordinates.length,
|
|
2
|
|
);
|
|
expect(isClosed).to.be(false);
|
|
});
|
|
});
|
|
});
|