Skip to content

Commit 5201701

Browse files
authored
build(libs): upgrade maplibre-gl-js and mobility-toolbox-js (#734)
* chore: upgrade libs * chore(release): 2.0.2-beta.0 * chore: revert stage * chore(release): 2.0.2-beta.0 * chore: upgrade mtb peer dep * chore: fix setupTests * chore: fix setupTests * chore: fix setupTests * chore: fix setupTests * chore: fix setupTests * chore: testing pre-commit * chore: testing pre-commit * chore: testing pre-commit * chore: update setupTests * chore: setup tests clean * chore: setup tests clean
1 parent 3eee579 commit 5201701

File tree

5 files changed

+122
-142
lines changed

5 files changed

+122
-142
lines changed

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-spatial",
33
"license": "MIT",
44
"description": "Components to build React map apps.",
5-
"version": "2.0.1",
5+
"version": "2.0.2-beta.0",
66
"dependencies": {
77
"@emotion/react": "^11.14.0",
88
"@emotion/styled": "^11.14.1",
@@ -16,7 +16,7 @@
1616
},
1717
"peerDependencies": {
1818
"maplibre-gl": "^4",
19-
"mobility-toolbox-js": "^3",
19+
"mobility-toolbox-js": "^3.6",
2020
"ol": "^10",
2121
"react": "^18",
2222
"react-dom": "^18"
@@ -64,8 +64,8 @@
6464
"jest-transformer-svg": "^2.1.0",
6565
"jsts": "2.12.1",
6666
"lint-staged": "16.1.5",
67-
"maplibre-gl": "5.6.2",
68-
"mobility-toolbox-js": "3.4.4",
67+
"maplibre-gl": "5.16.0",
68+
"mobility-toolbox-js": "3.6.4",
6969
"ol": "10.6.1",
7070
"postcss": "^8.5.6",
7171
"prettier": "3.6.2",
@@ -121,5 +121,6 @@
121121
"not op_mini all",
122122
"not ie <= 11",
123123
"not android < 5"
124-
]
124+
],
125+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
125126
}

src/components/BasicMap/BasicMap.test.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ proj4.defs(
2121
register(proj4);
2222

2323
const extent = [0, 0, 1000, 1000];
24-
const olLayers = [
25-
new OLLayer({
26-
name: "foo",
27-
visible: true,
28-
}),
29-
];
24+
const olLayers = [new OLLayer({ name: "foo", visible: true })];
3025

3126
describe("BasicMap", () => {
3227
let olMap;
@@ -106,9 +101,7 @@ describe("BasicMap", () => {
106101
// Test componentDidMount
107102
const { rerender } = render(
108103
<BasicMap map={olMap} onFeaturesHover={spy} />,
109-
{
110-
lifecycleExperimental: true,
111-
},
104+
{ lifecycleExperimental: true },
112105
);
113106
olMap.dispatchEvent(evt);
114107
expect(spy).toHaveBeenCalledTimes(1);
@@ -139,11 +132,7 @@ describe("BasicMap", () => {
139132
extent={extent}
140133
layers={olLayers}
141134
map={olMap}
142-
viewOptions={{
143-
maxZoom: 22,
144-
minZoom: 16,
145-
projection: "EPSG:21781",
146-
}}
135+
viewOptions={{ maxZoom: 22, minZoom: 16, projection: "EPSG:21781" }}
147136
/>,
148137
);
149138
expect(olMap.getLayers().getLength()).toBe(1);
@@ -175,9 +164,7 @@ describe("BasicMap", () => {
175164
});
176165

177166
test("animation shoud be set", () => {
178-
const obj = {
179-
zoom: 4,
180-
};
167+
const obj = { zoom: 4 };
181168
const { rerender } = render(<BasicMap map={olMap} />);
182169
const spy = jest.spyOn(olMap.getView(), "animate");
183170
rerender(<BasicMap animationOptions={obj} map={olMap} />);

src/components/Overlay/Overlay.test.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,7 @@ describe("Overlay", () => {
5757
// The mock class set the onResize property, we just have to run it to
5858
// simulate a resize
5959
ResizeObserver.onResize([
60-
{
61-
contentRect: {
62-
height: 200,
63-
width: 200,
64-
},
65-
target,
66-
},
60+
{ contentRect: { height: 200, width: 200 }, target },
6761
]);
6862
});
6963

@@ -79,13 +73,7 @@ describe("Overlay", () => {
7973

8074
act(() => {
8175
ResizeObserver.onResize([
82-
{
83-
contentRect: {
84-
height: 200,
85-
width: 1200,
86-
},
87-
target,
88-
},
76+
{ contentRect: { height: 200, width: 1200 }, target },
8977
]);
9078
});
9179

@@ -100,13 +88,7 @@ describe("Overlay", () => {
10088
// Force resize to make it mobile.
10189
act(() => {
10290
ResizeObserver.onResize([
103-
{
104-
contentRect: {
105-
height: 200,
106-
width: 200,
107-
},
108-
target,
109-
},
91+
{ contentRect: { height: 200, width: 200 }, target },
11092
]);
11193
});
11294

@@ -121,13 +103,7 @@ describe("Overlay", () => {
121103
// Force resize to make it mobile.
122104
act(() => {
123105
ResizeObserver.onResize([
124-
{
125-
contentRect: {
126-
height: 200,
127-
width: 200,
128-
},
129-
target,
130-
},
106+
{ contentRect: { height: 200, width: 200 }, target },
131107
]);
132108
});
133109
expect(container.querySelector(".tm-overlay-mobile")).not.toBe(null);

src/setupTests.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
import ResizeObserver from "resize-observer-polyfill";
2+
import util from "util";
3+
4+
if (!global.TextDecoder) {
5+
global.TextDecoder = util.TextDecoder;
6+
}
7+
8+
if (!global.TextEncoder) {
9+
global.TextEncoder = util.TextEncoder;
10+
}
211

312
global.URL.createObjectURL = jest.fn(() => {
413
return "fooblob";
@@ -23,21 +32,14 @@ class Worker {
2332
}
2433
}
2534

26-
Object.defineProperty(window, "Worker", {
27-
value: Worker,
28-
writable: true,
29-
});
35+
Object.defineProperty(window, "Worker", { value: Worker, writable: true });
3036

3137
const mock = {
3238
clearWatch: jest.fn(),
3339
getCurrentPosition: jest.fn(),
3440
watchPosition: (onSuccess) => {
3541
onSuccess({
36-
coords: {
37-
accuracy: 55,
38-
latitude: 47.9913611,
39-
longitude: 7.84868,
40-
},
42+
coords: { accuracy: 55, latitude: 47.9913611, longitude: 7.84868 },
4143
timestamp: 1552660077044,
4244
});
4345
},

0 commit comments

Comments
 (0)