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 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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user