我正在使用 Jest + RTL 为一个简单的 React 组件创建一个测试。
这是我的组件:
import React from 'react';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import Grid from '@material-ui/core/Grid';
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles((theme) => ({
centeredContent: {
justifyContent: 'center',
},
text: {
paddingLeft: theme.spacing(5),
},
spacer: {
paddingLeft: theme.spacing(5),
},
}));
interface SidebarItemProps {
children: any; //TODO - find an extensible type that we can use for {children}
text?: string;
openSidebar: boolean;
}
const SidebarItem: …Run Code Online (Sandbox Code Playgroud)