From f1c758f0dad622c2e77f194e20f566062f952342 Mon Sep 17 00:00:00 2001 From: Simon Seyock Date: Mon, 6 May 2024 17:47:27 +0200 Subject: [PATCH] fix: readd changes that were lost in rebase --- src/Button/CopyButton/CopyButton.tsx | 3 ++- src/Button/DeleteButton/DeleteButton.tsx | 4 ++-- src/Button/DrawButton/DrawButton.spec.tsx | 9 --------- src/Button/GeoLocationButton/GeoLocationButton.spec.tsx | 8 ++++++++ tsconfig.json | 3 ++- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Button/CopyButton/CopyButton.tsx b/src/Button/CopyButton/CopyButton.tsx index 7d482849ea..e6be8e1fe5 100644 --- a/src/Button/CopyButton/CopyButton.tsx +++ b/src/Button/CopyButton/CopyButton.tsx @@ -6,6 +6,7 @@ import { UseSelectFeaturesProps } from '@terrestris/react-util/dist/Hooks/useSelectFeatures/useSelectFeatures'; import { DigitizeUtil } from '@terrestris/react-util/dist/Util/DigitizeUtil'; +import OlFeature from 'ol/Feature'; import { SelectEvent as OlSelectEvent } from 'ol/interaction/Select'; import OlVectorLayer from 'ol/layer/Vector'; import OlVectorSource from 'ol/source/Vector'; @@ -23,7 +24,7 @@ interface OwnProps { * The vector layer which will be used for digitize features. * The standard digitizeLayer can be retrieved via `DigitizeUtil.getDigitizeLayer(map)`. */ - digitizeLayer?: OlVectorLayer; + digitizeLayer?: OlVectorLayer>; /** * Listener function for the 'select' event of the ol.interaction.Select * if in `Copy` mode. diff --git a/src/Button/DeleteButton/DeleteButton.tsx b/src/Button/DeleteButton/DeleteButton.tsx index aba87c8603..a62034e41c 100644 --- a/src/Button/DeleteButton/DeleteButton.tsx +++ b/src/Button/DeleteButton/DeleteButton.tsx @@ -5,6 +5,7 @@ import { UseSelectFeaturesProps } from '@terrestris/react-util/dist/Hooks/useSelectFeatures/useSelectFeatures'; import { DigitizeUtil } from '@terrestris/react-util/dist/Util/DigitizeUtil'; +import OlFeature from 'ol/Feature'; import { SelectEvent as OlSelectEvent } from 'ol/interaction/Select'; import OlVectorLayer from 'ol/layer/Vector'; import OlVectorSource from 'ol/source/Vector'; @@ -19,7 +20,7 @@ interface OwnProps { * The vector layer which will be used for digitize features. * The standard digitizeLayer can be retrieved via `DigitizeUtil.getDigitizeLayer(map)`. */ - digitizeLayer?: OlVectorLayer; + digitizeLayer?: OlVectorLayer>; /** * Listener function for the 'select' event of the ol.interaction.Select * if in `Delete` mode. @@ -47,7 +48,6 @@ export const DeleteButton: React.FC = ({ pressed, ...passThroughProps }) => { - const [layers, setLayers] = useState<[OlVectorLayer]|null>(null); const map = useMap(); diff --git a/src/Button/DrawButton/DrawButton.spec.tsx b/src/Button/DrawButton/DrawButton.spec.tsx index 0bcc13d301..a8e8996a11 100644 --- a/src/Button/DrawButton/DrawButton.spec.tsx +++ b/src/Button/DrawButton/DrawButton.spec.tsx @@ -216,15 +216,6 @@ describe('', () => { const startSpy = jest.fn(); const endSpy = jest.fn(); - const { rerenderInMapContext } = renderInMapContext(map, ( - - )); - expect(startSpy).not.toBeCalled(); expect(endSpy).not.toBeCalled(); diff --git a/src/Button/GeoLocationButton/GeoLocationButton.spec.tsx b/src/Button/GeoLocationButton/GeoLocationButton.spec.tsx index 49b861f463..d12c38aafc 100644 --- a/src/Button/GeoLocationButton/GeoLocationButton.spec.tsx +++ b/src/Button/GeoLocationButton/GeoLocationButton.spec.tsx @@ -5,14 +5,18 @@ import { } from '@terrestris/react-util/dist/Util/geolocationMock'; import { renderInMapContext } from '@terrestris/react-util/dist/Util/rtlTestUtils'; import { render } from '@testing-library/react'; +import OlMap from 'ol/Map'; import { fromLonLat } from 'ol/proj'; import * as React from 'react'; import { act } from 'react-dom/test-utils'; +import TestUtil from '../../Util/TestUtil'; import GeoLocationButton from './GeoLocationButton'; describe('', () => { + let map: OlMap; + beforeAll(() => { enableGeolocationMock(); }); @@ -21,6 +25,10 @@ describe('', () => { disableGeolocationMock(); }); + beforeEach(() => { + map = TestUtil.createMap(); + }); + describe('#Basics', () => { it('is defined', () => { diff --git a/tsconfig.json b/tsconfig.json index 5e2e3394cf..475fe73d7c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,6 +33,7 @@ "webpack", "jest", "coverage", - "src/Util/**" + "src/Util/**", + "**.config.js" ] }