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,39 +1,37 @@
|
||||
import CanvasVectorImageLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorImageLayer.js';
|
||||
import VectorImageLayer from '../../../../../src/ol/layer/VectorImage.js';
|
||||
import VectorSource from '../../../../../src/ol/source/Vector.js';
|
||||
import CanvasVectorImageLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorImageLayer.js';
|
||||
import {create} from '../../../../../src/ol/transform.js';
|
||||
import {get as getProjection} from '../../../../../src/ol/proj.js';
|
||||
import {scaleFromCenter} from '../../../../../src/ol/extent.js';
|
||||
import {create} from '../../../../../src/ol/transform.js';
|
||||
|
||||
|
||||
describe('ol/renderer/canvas/VectorImageLayer', function() {
|
||||
|
||||
describe('#dispose()', function() {
|
||||
|
||||
it('cleans up CanvasVectorRenderer', function() {
|
||||
describe('ol/renderer/canvas/VectorImageLayer', function () {
|
||||
describe('#dispose()', function () {
|
||||
it('cleans up CanvasVectorRenderer', function () {
|
||||
const layer = new VectorImageLayer({
|
||||
source: new VectorSource()
|
||||
source: new VectorSource(),
|
||||
});
|
||||
const renderer = new CanvasVectorImageLayerRenderer(layer);
|
||||
const spy = sinon.spy(renderer.vectorRenderer_, 'dispose');
|
||||
renderer.dispose();
|
||||
expect(spy.called).to.be(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#prepareFrame', function() {
|
||||
|
||||
it('sets correct extent with imageRatio = 2', function() {
|
||||
describe('#prepareFrame', function () {
|
||||
it('sets correct extent with imageRatio = 2', function () {
|
||||
const layer = new VectorImageLayer({
|
||||
imageRatio: 2,
|
||||
source: new VectorSource()
|
||||
source: new VectorSource(),
|
||||
});
|
||||
const renderer = new CanvasVectorImageLayerRenderer(layer);
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const projExtent = projection.getExtent();
|
||||
const extent = [
|
||||
projExtent[0] - 10000, -10000, projExtent[0] + 10000, 10000
|
||||
projExtent[0] - 10000,
|
||||
-10000,
|
||||
projExtent[0] + 10000,
|
||||
10000,
|
||||
];
|
||||
const frameState = {
|
||||
layerStatesArray: [layer.getLayerState()],
|
||||
@@ -45,8 +43,8 @@ describe('ol/renderer/canvas/VectorImageLayer', function() {
|
||||
center: [0, 0],
|
||||
projection: projection,
|
||||
resolution: 1,
|
||||
rotation: 0
|
||||
}
|
||||
rotation: 0,
|
||||
},
|
||||
};
|
||||
renderer.prepareFrame(frameState);
|
||||
const expected = renderer.image_.getExtent();
|
||||
@@ -56,5 +54,4 @@ describe('ol/renderer/canvas/VectorImageLayer', function() {
|
||||
expect(expected).to.eql(extent);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user