Skip to content

Commit 4e6694e

Browse files
authored
Merge pull request #728 from terrestris/fix-cleanup-layer-interaction
Ensure single extent layer and transform interaction
2 parents d6faf7f + 696c57b commit 4e6694e

20 files changed

+113
-100
lines changed

.github/workflows/on-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: npm ci
3434

3535
- name: Run typecheck, lint and tests 🧪
36-
run: npm test
36+
run: npm run check
3737

3838
- name: Build artifacts 🏗️
3939
run: npm run build:docs && npm run build:examples && npm run build:dist

.husky/pre-push

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
npm run lint
1+
npm run check

eslint.config.mjs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ export default tsEslint.config({
1717
'src/**/*.ts',
1818
'spec/**/*.spec.ts'
1919
],
20-
ignores: [
21-
'**/*.spec.ts',
22-
'**/dist/*.js',
23-
'**/jest/__mocks__/*.ts'
24-
],
2520
languageOptions: {
2621
ecmaVersion: 2022,
2722
globals: globals.browser,

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222
],
2323
"scripts": {
2424
"build": "npm run clean && npm run build:dist",
25-
"build:dist": "npm run clean:dist && tsc -p .",
25+
"build:dist": "npm run clean:dist && tsc -p ./tsconfig.build.json",
2626
"build:docs": "npm run clean:docs && typedoc",
2727
"build:examples": "npm run clean:examples && webpack --config webpack.prod.cjs",
2828
"clean": "npm run clean:dist && npm run clean:examples && npm run clean:docs",
29+
"check": "npm run typecheck && npm run lint && npm run test",
2930
"clean:dist": "rimraf ./dist/*",
3031
"clean:docs": "rimraf ./build/docs/*",
3132
"clean:examples": "rimraf ./build/examples/*",
32-
"lint": "eslint -c eslint.config.mjs",
33+
"lint": "eslint -c eslint.config.mjs src/ spec/",
3334
"lint:fix": "npm run lint -- --fix",
3435
"postpublish": "node ./tasks/update-gh-pages.cjs",
3536
"prepare": "husky",
3637
"prepublishOnly": "npm run build:dist && npm run build:docs",
37-
"pretest": "npm run clean:dist && npm run typecheck && npm run lint",
3838
"start": "webpack-dev-server --config webpack.dev.cjs",
39-
"test": "jest --maxWorkers=4 --coverage --config jest.config.cjs",
39+
"test": "jest --maxWorkers=50% --coverage --config jest.config.cjs",
4040
"test:watch": "jest --watchAll --config jest.config.cjs",
4141
"typecheck": "tsc --pretty --noEmit"
4242
},

spec/manager/MapFishPrintV2Manager.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import {
44
FetchMock
55
} from 'jest-fetch-mock';
66

7-
import OlMap from 'ol/Map';
87
import OlLayerImage from 'ol/layer/Image';
9-
import OlSourceImageWMS from 'ol/source/ImageWMS';
10-
import OlView from 'ol/View';
118
import OlLayerVector from 'ol/layer/Vector';
9+
import OlMap from 'ol/Map';
10+
import OlSourceImageWMS from 'ol/source/ImageWMS';
1211
import OlSourceVector from 'ol/source/Vector';
13-
14-
import { MapFishPrintV2Manager } from '../../src/index';
12+
import OlView from 'ol/View';
1513

1614
import mockResponse from '../../assets/v2/info.json';
1715

16+
import { MapFishPrintV2Manager } from '../../src/index';
17+
1818
describe('MapFishPrintV2Manager', () => {
1919

2020
const testMap = new OlMap({

spec/manager/MapFishPrintV3Manager.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ import {
44
FetchMock
55
} from 'jest-fetch-mock';
66

7-
import OlMap from 'ol/Map';
8-
import OlView from 'ol/View';
97
import OlLayerVector from 'ol/layer/Vector';
8+
import OlMap from 'ol/Map';
109
import OlSourceVector from 'ol/source/Vector';
11-
12-
import { MapFishPrintV3Manager, V3CustomMapParams } from '../../src/manager/MapFishPrintV3Manager';
10+
import OlView from 'ol/View';
1311

1412
import printAppsMockResponse from '../../assets/v3/apps.json';
1513
import printCapabilitiesMockResponse from '../../assets/v3/capabilities.json';
14+
import { MapFishPrintV3Manager, V3CustomMapParams } from '../../src/manager/MapFishPrintV3Manager';
1615

1716
describe('MapFishPrintV3Manager', () => {
1817

@@ -80,6 +79,7 @@ describe('MapFishPrintV3Manager', () => {
8079
url: 'https://mock:8080/print/pdf/'
8180
});
8281

82+
// @ts-expect-error protected method
8383
const response = await manager.loadPrintApps();
8484

8585
expect(response).toEqual(printAppsMockResponse);
@@ -96,6 +96,7 @@ describe('MapFishPrintV3Manager', () => {
9696

9797
const printApp = 'default';
9898

99+
// @ts-expect-error protected method
99100
const response = await manager.loadAppCapabilities(printApp);
100101

101102
expect(response.app).toBe(printCapabilitiesMockResponse.app);
@@ -107,6 +108,7 @@ describe('MapFishPrintV3Manager', () => {
107108
map: testMap,
108109
url: 'https://mock:8080/print/pdf/'
109110
});
111+
// @ts-expect-error protected method
110112
expect(manager.getBasePath).not.toBeUndefined();
111113
});
112114
});

spec/serializer/MapFishPrintV2VectorSerializer.spec.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
import OlLayerVector from 'ol/layer/Vector';
1+
import OlFeature from 'ol/Feature';
2+
import { Geometry } from 'ol/geom';
3+
import OlGeomLineString from 'ol/geom/LineString';
4+
import OlGeomPoint from 'ol/geom/Point';
5+
import OlGeomPolygon from 'ol/geom/Polygon';
26
import OlLayerTile from 'ol/layer/Tile';
3-
import OlSourceVector from 'ol/source/Vector';
7+
import OlLayerVector from 'ol/layer/Vector';
48
import OlSourceOSM from 'ol/source/OSM';
5-
import OlStyleStyle from 'ol/style/Style';
9+
import OlSourceVector from 'ol/source/Vector';
610
import OlStyleCircle from 'ol/style/Circle';
7-
import OlStyleText from 'ol/style/Text';
8-
import OlStyleStroke from 'ol/style/Stroke';
911
import OlStyleFill from 'ol/style/Fill';
10-
import OlFeature from 'ol/Feature';
11-
import OlGeomPoint from 'ol/geom/Point';
12-
import OlGeomLineString from 'ol/geom/LineString';
13-
import OlGeomPolygon from 'ol/geom/Polygon';
12+
import OlStyleStroke from 'ol/style/Stroke';
13+
import OlStyleStyle from 'ol/style/Style';
14+
import OlStyleText from 'ol/style/Text';
1415

1516
import { MapFishPrintV2VectorSerializer } from '../../src/serializer/MapFishPrintV2VectorSerializer';
16-
import { Geometry } from 'ol/geom';
17-
import Feature from 'ol/Feature';
1817

1918
describe('MapFishPrintV2VectorSerializer', () => {
2019
let serializer: MapFishPrintV2VectorSerializer;
@@ -197,7 +196,7 @@ describe('MapFishPrintV2VectorSerializer', () => {
197196
]])
198197
});
199198

200-
const features: Feature<Geometry>[] = [
199+
const features: OlFeature<Geometry>[] = [
201200
pointFeature1,
202201
pointFeature2,
203202
lineFeature,

spec/serializer/MapFishPrintV2WMSSerializer.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import OlLayerImage from 'ol/layer/Image';
22
import OlLayerTile from 'ol/layer/Tile';
33
import OlSourceImageWMS from 'ol/source/ImageWMS';
4-
import OlSourceTileWMS from 'ol/source/TileWMS';
54
import OlSourceOSM from 'ol/source/OSM';
5+
import OlSourceTileWMS from 'ol/source/TileWMS';
66

77
import { MapFishPrintV2WMSSerializer } from '../../src/serializer/MapFishPrintV2WMSSerializer';
88

spec/serializer/MapFishPrintV3GeoJsonSerializer.spec.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
import OlFeature from 'ol/Feature';
2+
import { Geometry } from 'ol/geom';
3+
import OlGeomLineString from 'ol/geom/LineString';
4+
import OlGeomPoint from 'ol/geom/Point';
5+
import OlGeomPolygon from 'ol/geom/Polygon';
16
import OlLayerImage from 'ol/layer/Image';
27
import OlLayerVector from 'ol/layer/Vector';
38
import OlSourceImageWMS from 'ol/source/ImageWMS';
49
import OlSourceVector from 'ol/source/Vector';
5-
import OlFeature from 'ol/Feature';
6-
import OlGeomPoint from 'ol/geom/Point';
7-
import OlGeomLineString from 'ol/geom/LineString';
8-
import OlGeomPolygon from 'ol/geom/Polygon';
910

1011
import { MapFishPrintV3GeoJsonSerializer } from '../../src/serializer/MapFishPrintV3GeoJsonSerializer';
11-
import { Geometry } from 'ol/geom';
1212

1313
describe('MapFishPrintV3GeoJsonSerializer', () => {
1414
let serializer: MapFishPrintV3GeoJsonSerializer;
@@ -147,8 +147,4 @@ describe('MapFishPrintV3GeoJsonSerializer', () => {
147147
renderAsSvg: false
148148
});
149149
});
150-
151-
it('accepts additional serializer opts', () => {
152-
153-
});
154150
});

spec/serializer/MapFishPrintV3TiledWMSSerializer.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import OlLayerTile from 'ol/layer/Tile';
2-
import OlSourceTileWMS from 'ol/source/TileWMS';
32
import OlSourceOSM from 'ol/source/OSM';
3+
import OlSourceTileWMS from 'ol/source/TileWMS';
44

55
import { MapFishPrintV3TiledWMSSerializer } from '../../src/serializer/MapFishPrintV3TiledWMSSerializer';
66

0 commit comments

Comments
 (0)