Skip to content

Commit f0e9fc0

Browse files
AliyanHprushforth
authored andcommitted
add a parameter for convertAndFormatPCRS
Enable playwright tests, disable jest tests, possibly forever. Skip featureIndexOverlay tests for now Do 'npx playwright install' after 'npm install' per playwright error message.
1 parent fb05f69 commit f0e9fc0

File tree

7 files changed

+35
-17
lines changed

7 files changed

+35
-17
lines changed

.github/workflows/ci-testing.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ jobs:
1313
uses: actions/setup-node@v3
1414
with:
1515
node-version: '18.x'
16-
# - run: sudo apt-get install xvfb
17-
# - run: npm install --legacy-peer-deps
18-
# - run: npm install -g grunt-cli
19-
# - run: grunt default
20-
# - run: xvfb-run --auto-servernum -- npm test
16+
- run: sudo apt-get install xvfb
17+
- run: npm install --legacy-peer-deps
18+
- run: npx playwright install
19+
- run: npm install -g grunt-cli
20+
- run: grunt default
21+
- run: xvfb-run --auto-servernum -- npm test
2122
# - run: xvfb-run --auto-servernum -- npm run jest
2223
env:
2324
CI: true

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
}
3333
],
3434
"scripts": {
35-
"test": "npx playwright test",
35+
"test": "npx playwright test --grep-invert='featureIndexOverlay.*'",
3636
"jest": "jest --verbose --noStackTrace"
3737
},
3838
"devDependencies": {

src/map-feature.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,11 @@ export class MapFeature extends HTMLElement {
421421
);
422422
}
423423
let result = Object.assign(
424-
M._convertAndFormatPCRS(pcrsBound, map.options.crs),
425-
{ projection: map.options.projection }
424+
M._convertAndFormatPCRS(
425+
pcrsBound,
426+
map.options.crs,
427+
map.options.projection
428+
)
426429
);
427430
// memoize calculated result
428431
extentCache = result;

src/mapml-viewer.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,17 @@ export class MapViewer extends HTMLElement {
109109
map.getZoom(),
110110
map.options.projection
111111
);
112-
let formattedExtent = M._convertAndFormatPCRS(pcrsBounds, map.options.crs);
112+
let formattedExtent = M._convertAndFormatPCRS(
113+
pcrsBounds,
114+
map.options.crs,
115+
this.projection
116+
);
113117
if (map.getMaxZoom() !== Infinity) {
114118
formattedExtent.zoom = {
115119
minZoom: map.getMinZoom(),
116120
maxZoom: map.getMaxZoom()
117121
};
118122
}
119-
formattedExtent.projection = this.projection;
120123
return formattedExtent;
121124
}
122125
get static() {

src/mapml/layers/MapMLLayer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,12 @@ export var MapMLLayer = L.Layer.extend({
408408
if (bounds) {
409409
//assigns the formatted extent object to .extent and spreads the zoom ranges to .extent also
410410
this._layerEl.extent = Object.assign(
411-
M._convertAndFormatPCRS(bounds, this._properties.crs),
412-
{ zoom: zoomBounds, projection: this._properties.projection }
411+
M._convertAndFormatPCRS(
412+
bounds,
413+
this._properties.crs,
414+
this._properties.projection
415+
),
416+
{ zoom: zoomBounds }
413417
);
414418
}
415419
},

src/mapml/utils/Util.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { FALLBACK_CS, FALLBACK_PROJECTION } from './Constants';
22

33
export var Util = {
44
// _convertAndFormatPCRS returns the converted CRS and formatted pcrsBounds in gcrs, pcrs, tcrs, and tilematrix. Used for setting extent for the map and layer (map.extent, layer.extent).
5-
// _convertAndFormatPCRS: L.Bounds, _map -> {...}
6-
_convertAndFormatPCRS: function (pcrsBounds, crs) {
5+
// _convertAndFormatPCRS: L.Bounds, _map, projection -> {...}
6+
_convertAndFormatPCRS: function (pcrsBounds, crs, projection) {
77
if (!pcrsBounds || !crs) return {};
88

99
let tcrsTopLeft = [],
@@ -65,7 +65,7 @@ export var Util = {
6565
};
6666

6767
//formats all extent data
68-
return {
68+
let extent = {
6969
topLeft: {
7070
tcrs: tcrsTopLeft,
7171
tilematrix: tileMatrixTopLeft,
@@ -79,6 +79,10 @@ export var Util = {
7979
pcrs: pcrs.bottomRight
8080
}
8181
};
82+
if (projection) {
83+
extent.projection = projection;
84+
}
85+
return extent;
8286
},
8387

8488
// _extractInputBounds extracts and returns Input Bounds from the provided template

src/web-map.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,17 @@ export class WebMap extends HTMLMapElement {
113113
map.getZoom(),
114114
map.options.projection
115115
);
116-
let formattedExtent = M._convertAndFormatPCRS(pcrsBounds, map.options.crs);
116+
let formattedExtent = M._convertAndFormatPCRS(
117+
pcrsBounds,
118+
map.options.crs,
119+
this.projection
120+
);
117121
if (map.getMaxZoom() !== Infinity) {
118122
formattedExtent.zoom = {
119123
minZoom: map.getMinZoom(),
120124
maxZoom: map.getMaxZoom()
121125
};
122126
}
123-
formattedExtent.projection = this.projection;
124127
return formattedExtent;
125128
}
126129
get static() {

0 commit comments

Comments
 (0)