Skip to content

Commit

Permalink
[Tests] prop-types: add passing test
Browse files Browse the repository at this point in the history
Closes #2760
  • Loading branch information
ljharb committed Feb 20, 2022
1 parent c57eac8 commit 02bd7da
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/lib/rules/prop-types.js
Expand Up @@ -3871,6 +3871,46 @@ ruleTester.run('prop-types', rule, {
export default Component;
`,
features: ['types'],
},
{
code: `
export default React.memo(function AppIcon({
icon,
className,
title,
spinning,
}: {
icon: string | IconDefinition;
className?: string;
title?: string;
spinning?: boolean;
}) {
if (typeof icon === 'string') {
return (
<span
className={clsx(
icon,
'app-icon',
'no-pointer-events',
className,
spinning ? 'fa-spin' : false
)}
title={title}
/>
);
} else {
return (
<FontAwesomeIcon
className={className ? 'app-icon ' + className : 'app-icon'}
icon={icon}
title={title}
spin={spinning}
/>
);
}
});
`,
features: ['types'],
}
)),

Expand Down

0 comments on commit 02bd7da

Please sign in to comment.