Skip to content

Commit

Permalink
[Tests] no-multi-comp: add passing test
Browse files Browse the repository at this point in the history
Closes #3412
  • Loading branch information
ljharb committed Sep 5, 2022
1 parent 1c3af25 commit 22c569b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/lib/rules/no-multi-comp.js
Expand Up @@ -203,6 +203,39 @@ ruleTester.run('no-multi-comp', rule, {
`,
features: ['class fields'],
},
{
code: `
const MenuList = forwardRef(({onClose, ...props}, ref) => {
const {t} = useTranslation();
const handleLogout = useLogoutHandler();
const onLogout = useCallback(() => {
onClose();
handleLogout();
}, [onClose, handleLogout]);
return (
<MuiMenuList ref={ref} {...props}>
<MuiMenuItem key="logout" onClick={onLogout}>
{t('global-logout')}
</MuiMenuItem>
</MuiMenuList>
);
});
MenuList.displayName = 'MenuList';
MenuList.propTypes = {
onClose: PropTypes.func,
};
MenuList.defaultProps = {
onClose: () => null,
};
export default MenuList;
`,
},
]),

invalid: parsers.all([
Expand Down

0 comments on commit 22c569b

Please sign in to comment.