Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react-spatial",
"license": "MIT",
"description": "Components to build React map apps.",
"version": "2.0.1",
"version": "2.0.2-beta.0",
"dependencies": {
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
Expand All @@ -16,7 +16,7 @@
},
"peerDependencies": {
"maplibre-gl": "^4",
"mobility-toolbox-js": "^3",
"mobility-toolbox-js": "^3.6",
"ol": "^10",
"react": "^18",
"react-dom": "^18"
Expand Down Expand Up @@ -64,8 +64,8 @@
"jest-transformer-svg": "^2.1.0",
"jsts": "2.12.1",
"lint-staged": "16.1.5",
"maplibre-gl": "5.6.2",
"mobility-toolbox-js": "3.4.4",
"maplibre-gl": "5.16.0",
"mobility-toolbox-js": "3.6.4",
"ol": "10.6.1",
"postcss": "^8.5.6",
"prettier": "3.6.2",
Expand Down Expand Up @@ -121,5 +121,6 @@
"not op_mini all",
"not ie <= 11",
"not android < 5"
]
],
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
21 changes: 4 additions & 17 deletions src/components/BasicMap/BasicMap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ proj4.defs(
register(proj4);

const extent = [0, 0, 1000, 1000];
const olLayers = [
new OLLayer({
name: "foo",
visible: true,
}),
];
const olLayers = [new OLLayer({ name: "foo", visible: true })];

describe("BasicMap", () => {
let olMap;
Expand Down Expand Up @@ -106,9 +101,7 @@ describe("BasicMap", () => {
// Test componentDidMount
const { rerender } = render(
<BasicMap map={olMap} onFeaturesHover={spy} />,
{
lifecycleExperimental: true,
},
{ lifecycleExperimental: true },
);
olMap.dispatchEvent(evt);
expect(spy).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -139,11 +132,7 @@ describe("BasicMap", () => {
extent={extent}
layers={olLayers}
map={olMap}
viewOptions={{
maxZoom: 22,
minZoom: 16,
projection: "EPSG:21781",
}}
viewOptions={{ maxZoom: 22, minZoom: 16, projection: "EPSG:21781" }}
/>,
);
expect(olMap.getLayers().getLength()).toBe(1);
Expand Down Expand Up @@ -175,9 +164,7 @@ describe("BasicMap", () => {
});

test("animation shoud be set", () => {
const obj = {
zoom: 4,
};
const obj = { zoom: 4 };
const { rerender } = render(<BasicMap map={olMap} />);
const spy = jest.spyOn(olMap.getView(), "animate");
rerender(<BasicMap animationOptions={obj} map={olMap} />);
Expand Down
32 changes: 4 additions & 28 deletions src/components/Overlay/Overlay.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,7 @@ describe("Overlay", () => {
// The mock class set the onResize property, we just have to run it to
// simulate a resize
ResizeObserver.onResize([
{
contentRect: {
height: 200,
width: 200,
},
target,
},
{ contentRect: { height: 200, width: 200 }, target },
]);
});

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

act(() => {
ResizeObserver.onResize([
{
contentRect: {
height: 200,
width: 1200,
},
target,
},
{ contentRect: { height: 200, width: 1200 }, target },
]);
});

Expand All @@ -100,13 +88,7 @@ describe("Overlay", () => {
// Force resize to make it mobile.
act(() => {
ResizeObserver.onResize([
{
contentRect: {
height: 200,
width: 200,
},
target,
},
{ contentRect: { height: 200, width: 200 }, target },
]);
});

Expand All @@ -121,13 +103,7 @@ describe("Overlay", () => {
// Force resize to make it mobile.
act(() => {
ResizeObserver.onResize([
{
contentRect: {
height: 200,
width: 200,
},
target,
},
{ contentRect: { height: 200, width: 200 }, target },
]);
});
expect(container.querySelector(".tm-overlay-mobile")).not.toBe(null);
Expand Down
20 changes: 11 additions & 9 deletions src/setupTests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import ResizeObserver from "resize-observer-polyfill";
import util from "util";

if (!global.TextDecoder) {
global.TextDecoder = util.TextDecoder;
}

if (!global.TextEncoder) {
global.TextEncoder = util.TextEncoder;
}

global.URL.createObjectURL = jest.fn(() => {
return "fooblob";
Expand All @@ -23,21 +32,14 @@ class Worker {
}
}

Object.defineProperty(window, "Worker", {
value: Worker,
writable: true,
});
Object.defineProperty(window, "Worker", { value: Worker, writable: true });

const mock = {
clearWatch: jest.fn(),
getCurrentPosition: jest.fn(),
watchPosition: (onSuccess) => {
onSuccess({
coords: {
accuracy: 55,
latitude: 47.9913611,
longitude: 7.84868,
},
coords: { accuracy: 55, latitude: 47.9913611, longitude: 7.84868 },
timestamp: 1552660077044,
});
},
Expand Down
Loading