diff --git a/components/Map/MarkableMap.js b/components/Map/MarkableMap.js index bfa805ba2..d2abed666 100644 --- a/components/Map/MarkableMap.js +++ b/components/Map/MarkableMap.js @@ -9,6 +9,7 @@ import isEqual from 'lodash/fp/isEqual'; import uniqueId from 'lodash/fp/uniqueId'; import cx from 'classnames'; +import lngLat from '../../utils/propTypeValidations/lngLat'; import minLngLatBounds from '../../utils/geoUtils/minLngLatBounds'; import mapboxgl from '../../utils/mapboxgl/mapboxgl'; import MarkerContainer from './MarkerContainer'; @@ -27,8 +28,17 @@ import css from './MarkableMap.css'; export default class MarkableMap extends Component { static propTypes = { - // TODO: shapeOf prop type - markers: PropTypes.array, + markers: PropTypes.arrayOf( + PropTypes.shape({ + id: React.PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + ]).isRequired, + lngLat: lngLat.isRequired, + label: PropTypes.string.isRequired, + props: PropTypes.object, + }) + ), MarkerComponent: PropTypes.func.isRequired, autoFit: PropTypes.bool, }; diff --git a/components/Map/MarkableMap.test.js b/components/Map/MarkableMap.test.js index 25546ce96..14cdce54c 100644 --- a/components/Map/MarkableMap.test.js +++ b/components/Map/MarkableMap.test.js @@ -30,7 +30,7 @@ it('it renders the active marker correctly', () => { { component = c; } } MarkerComponent={ SpaceMarker } - markers={ [{ id: 1, lngLat: [1, 0] }] } + markers={ [{ id: 1, lngLat: [1, 0], label: 'test' }] } />, div ); @@ -54,7 +54,7 @@ it('it autosizes the map correctly', () => { ReactDOM.render( , div @@ -68,8 +68,8 @@ it('it autosizes the map correctly', () => { , @@ -87,8 +87,8 @@ it('it autosizes the map correctly', () => { , @@ -106,7 +106,7 @@ it('unmounts without crashing', () => { ReactDOM.render( , div );