Updating component mock to handle non-standard attrs

This commit is contained in:
Jeff Avallone 2019-03-24 12:57:09 -04:00
parent babab418c7
commit d813fdf742
2 changed files with 8 additions and 3 deletions

View File

@ -3,7 +3,9 @@ const React = require('react');
const buildMock = component => {
const componentName = component.displayName || component.name || 'Component';
const Mock = ({ children, ...props }) => (
<span data-component={ componentName } { ...props }>{ children }</span>
<span
data-component={ componentName }
data-props={ JSON.stringify(props, null, ' ') }>{ children }</span>
);
Mock.propTypes = component.propTypes;
return Mock;

View File

@ -4,12 +4,15 @@ exports[`SentryError rendering 1`] = `
<DocumentFragment>
<span
data-component="Message"
heading="TRANSLATE(An error has occurred)"
type="error"
data-props="{
\\"type\\": \\"error\\",
\\"heading\\": \\"TRANSLATE(An error has occurred)\\"
}"
>
<p>
<span
data-component="Trans"
data-props="{}"
>
This error has been logged. You may also
<a