Updating component mock to handle non-standard attrs
This commit is contained in:
parent
babab418c7
commit
d813fdf742
@ -3,7 +3,9 @@ const React = require('react');
|
|||||||
const buildMock = component => {
|
const buildMock = component => {
|
||||||
const componentName = component.displayName || component.name || 'Component';
|
const componentName = component.displayName || component.name || 'Component';
|
||||||
const Mock = ({ children, ...props }) => (
|
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;
|
Mock.propTypes = component.propTypes;
|
||||||
return Mock;
|
return Mock;
|
||||||
|
@ -4,12 +4,15 @@ exports[`SentryError rendering 1`] = `
|
|||||||
<DocumentFragment>
|
<DocumentFragment>
|
||||||
<span
|
<span
|
||||||
data-component="Message"
|
data-component="Message"
|
||||||
heading="TRANSLATE(An error has occurred)"
|
data-props="{
|
||||||
type="error"
|
\\"type\\": \\"error\\",
|
||||||
|
\\"heading\\": \\"TRANSLATE(An error has occurred)\\"
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
<span
|
<span
|
||||||
data-component="Trans"
|
data-component="Trans"
|
||||||
|
data-props="{}"
|
||||||
>
|
>
|
||||||
This error has been logged. You may also
|
This error has been logged. You may also
|
||||||
<a
|
<a
|
||||||
|
Loading…
Reference in New Issue
Block a user