Skip to content

Commit

Permalink
Format SVG React snapshots as <svg> tag with props (#5196)
Browse files Browse the repository at this point in the history
* Format SVG React snapshots as <svg> tag with props

* Keep output simpler
  • Loading branch information
gaearon authored Oct 1, 2018
1 parent aa57262 commit 53e4c0a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/react-scripts/config/jest/fileTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ module.exports = {
return `module.exports = {
__esModule: true,
default: ${assetFilename},
ReactComponent: () => ${assetFilename},
ReactComponent: (props) => ({
$$typeof: Symbol.for('react.element'),
type: 'svg',
ref: null,
key: null,
props: Object.assign({}, props, {
children: ${assetFilename}
})
}),
};`;
}

Expand Down

0 comments on commit 53e4c0a

Please sign in to comment.