diff options
Diffstat (limited to 'openecomp-ui/test-utils/MockSVGIcon.js')
-rw-r--r-- | openecomp-ui/test-utils/MockSVGIcon.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/openecomp-ui/test-utils/MockSVGIcon.js b/openecomp-ui/test-utils/MockSVGIcon.js new file mode 100644 index 0000000000..6ce76cf91a --- /dev/null +++ b/openecomp-ui/test-utils/MockSVGIcon.js @@ -0,0 +1,17 @@ +import React from 'react'; +//import ReactDOMServer from 'react-dom/server'; + +const SVGIcon = ({name, onClick, label, className, iconClassName, labelClassName, labelPosition, color, disabled, ...other}) => { + let colorClass = (color !== '') ? '__' + color : ''; + let classes = `svg-icon-wrapper ${iconClassName} ${className} ${colorClass} ${onClick ? 'clickable' : ''} ${disabled ? 'disabled' : ''} ${labelPosition}`; + + let iconMock = ( + <div {...other} onClick={onClick} className={classes}> + <span className={`svg-icon __${name} ${disabled ? 'disabled' : ''}`} /> + {label && <span className={`svg-icon-label ${labelClassName}`}>{label}</span>} + </div> + ); +// console.log(ReactDOMServer.renderToStaticMarkup(iconMock)); + return iconMock; +}; +export default SVGIcon; |