Skip to content

Commit 22c569b

Browse files
committed
[Tests] no-multi-comp: add passing test
Closes #3412
1 parent 1c3af25 commit 22c569b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/lib/rules/no-multi-comp.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,39 @@ ruleTester.run('no-multi-comp', rule, {
203203
`,
204204
features: ['class fields'],
205205
},
206+
{
207+
code: `
208+
const MenuList = forwardRef(({onClose, ...props}, ref) => {
209+
const {t} = useTranslation();
210+
const handleLogout = useLogoutHandler();
211+
212+
const onLogout = useCallback(() => {
213+
onClose();
214+
handleLogout();
215+
}, [onClose, handleLogout]);
216+
217+
return (
218+
<MuiMenuList ref={ref} {...props}>
219+
<MuiMenuItem key="logout" onClick={onLogout}>
220+
{t('global-logout')}
221+
</MuiMenuItem>
222+
</MuiMenuList>
223+
);
224+
});
225+
226+
MenuList.displayName = 'MenuList';
227+
228+
MenuList.propTypes = {
229+
onClose: PropTypes.func,
230+
};
231+
232+
MenuList.defaultProps = {
233+
onClose: () => null,
234+
};
235+
236+
export default MenuList;
237+
`,
238+
},
206239
]),
207240

208241
invalid: parsers.all([

0 commit comments

Comments
 (0)