Skip to content

Commit

Permalink
fix: readd changes that were lost in rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
simonseyock committed May 6, 2024
1 parent 38dabed commit f1c758f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/Button/CopyButton/CopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<OlVectorSource>;
digitizeLayer?: OlVectorLayer<OlVectorSource<OlFeature>>;
/**
* Listener function for the 'select' event of the ol.interaction.Select
* if in `Copy` mode.
Expand Down
4 changes: 2 additions & 2 deletions src/Button/DeleteButton/DeleteButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<OlVectorSource>;
digitizeLayer?: OlVectorLayer<OlVectorSource<OlFeature>>;
/**
* Listener function for the 'select' event of the ol.interaction.Select
* if in `Delete` mode.
Expand Down Expand Up @@ -47,7 +48,6 @@ export const DeleteButton: React.FC<DeleteButtonProps> = ({
pressed,
...passThroughProps
}) => {
const [layers, setLayers] = useState<[OlVectorLayer<OlVectorSource>]|null>(null);

const map = useMap();

Expand Down
9 changes: 0 additions & 9 deletions src/Button/DrawButton/DrawButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,6 @@ describe('<DrawButton />', () => {
const startSpy = jest.fn();
const endSpy = jest.fn();

const { rerenderInMapContext } = renderInMapContext(map, (
<DrawButton
pressed={true}
drawType={'Polygon'}
onDrawStart={startSpy}
onDrawEnd={endSpy}
/>
));

expect(startSpy).not.toBeCalled();
expect(endSpy).not.toBeCalled();

Expand Down
8 changes: 8 additions & 0 deletions src/Button/GeoLocationButton/GeoLocationButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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('<GeoLocationButton />', () => {

let map: OlMap;

beforeAll(() => {
enableGeolocationMock();
});
Expand All @@ -21,6 +25,10 @@ describe('<GeoLocationButton />', () => {
disableGeolocationMock();
});

beforeEach(() => {
map = TestUtil.createMap();
});

describe('#Basics', () => {

it('is defined', () => {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"webpack",
"jest",
"coverage",
"src/Util/**"
"src/Util/**",
"**.config.js"
]
}

0 comments on commit f1c758f

Please sign in to comment.