From 2ee2efe1b968aeadc6f7636bf8a13354659b53fd Mon Sep 17 00:00:00 2001 From: Amber Febbraro Date: Sat, 26 Oct 2019 18:30:51 -0400 Subject: [PATCH] fix spark-react test errors by adding react component proptype, see: https://github.com/facebook/prop-types/pull/211 --- react/src/base/links/SprkLink.js | 6 +++++- .../card/components/SprkCardTeaser/SprkCardTeaser.js | 12 ++++++++++-- react/src/components/masthead/SprkMasthead.js | 6 +++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/react/src/base/links/SprkLink.js b/react/src/base/links/SprkLink.js index 126c27b6dc..31c5ba874c 100644 --- a/react/src/base/links/SprkLink.js +++ b/react/src/base/links/SprkLink.js @@ -90,7 +90,11 @@ SprkLink.propTypes = { /** The href value for the link. */ href: PropTypes.string, /** The element that will be rendered. */ - element: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), + element: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.func, + PropTypes.elementType + ]), /** The event that will fire when the element is clicked. */ onClick: PropTypes.func, }; diff --git a/react/src/components/card/components/SprkCardTeaser/SprkCardTeaser.js b/react/src/components/card/components/SprkCardTeaser/SprkCardTeaser.js index 1fbfb2bde7..78778f4524 100644 --- a/react/src/components/card/components/SprkCardTeaser/SprkCardTeaser.js +++ b/react/src/components/card/components/SprkCardTeaser/SprkCardTeaser.js @@ -207,7 +207,11 @@ SprkCardTeaser.propTypes = { additionalCtaIconClasses: PropTypes.string, ctaAnalytics: PropTypes.string, ctaIcon: PropTypes.string, - ctaLinkElement: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), + ctaLinkElement: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.func, + PropTypes.elementType + ]), ctaVariant: PropTypes.oneOf(['link', 'button']), href: PropTypes.string, text: PropTypes.string, @@ -215,7 +219,11 @@ SprkCardTeaser.propTypes = { media: PropTypes.shape({ additionalMediaIconClasses: PropTypes.string, href: PropTypes.string, - mediaLinkElement: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), + mediaLinkElement: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.func, + PropTypes.elementType + ]), iconName: PropTypes.string, imgAlt: PropTypes.string, imgSrc: PropTypes.string, diff --git a/react/src/components/masthead/SprkMasthead.js b/react/src/components/masthead/SprkMasthead.js index ac84beea49..381962dbdd 100644 --- a/react/src/components/masthead/SprkMasthead.js +++ b/react/src/components/masthead/SprkMasthead.js @@ -323,7 +323,11 @@ SprkMasthead.propTypes = { /** The href to render for the logo link. */ logoLink: PropTypes.string, /** The element link element to render for the logo. */ - logoLinkElement: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), + logoLinkElement: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.func, + PropTypes.elementType + ]), /** Expects a component to render the nav link. */ navLink: PropTypes.node, };