diff --git a/src/components/App/index.js b/src/components/App/index.js index 3affa72..3ae29d0 100644 --- a/src/components/App/index.js +++ b/src/components/App/index.js @@ -146,7 +146,7 @@ class App extends React.PureComponent {

Sample warning message

{ image &&
- +
} ; } diff --git a/src/components/App/test.js b/src/components/App/test.js index bd1f027..ae71f5d 100644 --- a/src/components/App/test.js +++ b/src/components/App/test.js @@ -4,12 +4,10 @@ import React from 'react'; import { shallow } from 'enzyme'; import { App } from 'components/App'; -import renderImage from 'components/SVG'; import { translate } from '__mocks__/i18n'; describe('App', () => { test('rendering', () => { - renderImage.mockReturnValue('Testing image'); const component = shallow( ); diff --git a/src/components/SVG/index.js b/src/components/SVG/index.js index 9a55296..d61ea4d 100644 --- a/src/components/SVG/index.js +++ b/src/components/SVG/index.js @@ -34,15 +34,14 @@ const render = (data, extraProps) => { children.length === 1 ? children[0] : children); }; -const SVG = ({ data, imageRef: ref }) => render(data, { ref }); +const SVG = React.forwardRef(({ data }, ref) => render(data, { ref })); SVG.propTypes = { data: PropTypes.shape({ type: PropTypes.oneOf(Object.keys(nodeTypes)).isRequired, props: PropTypes.object, children: PropTypes.array - }).isRequired, - imageRef: PropTypes.func + }).isRequired }; export default SVG; diff --git a/src/components/SVG/test.js b/src/components/SVG/test.js index fa44d1f..b29a3c5 100644 --- a/src/components/SVG/test.js +++ b/src/components/SVG/test.js @@ -1,8 +1,7 @@ import React from 'react'; -import { shallow, mount } from 'enzyme'; +import { shallow } from 'enzyme'; import SVG from 'components/SVG'; -import Pin from './Pin'; describe('SVG', () => { test('rendering', async () => { @@ -94,16 +93,4 @@ describe('SVG', () => { ); expect(component).toMatchSnapshot(); }); - - test('imageRef prop', () => { - let image; - const imageRef = element => image = element; - const data = { - type: 'Pin' - }; - mount( - - ); - expect(image).toBeInstanceOf(Pin); - }); });