Hello,
I've an issue while reading the documentation of material-ui:
https://material-ui.com/guides/testing/#createmount-options-mount
I can't fully understand how to write my tests with custom styles and with this exemple:
import { createMount } from '@material-ui/core/test-utils';
import { MuiThemeProvider } from '@material-ui/core/styles';
describe('<MyComponent />', () => {
let mount;
function MySuccessButton({ children }) {
return (
<MuiThemeProvider theme={{ success: { main: '#fff' } }}>
{children}
</MuiThemeProvider>
);
}
before(() => {
mount = createMount();
});
after(() => {
mount.cleanUp();
});
it('should work', () => {
const wrapper = mount(<MockedTheme><MySuccessButton /></MockedTheme>);
});
});
Here is some questions:
- What is MockedTheme, how and where is it ?
- Where
MyComponent should be mounted ?
- Did you plan for a TypeScript version of your tests ?
While testing, I ran into this issue:
Error: Uncaught [TypeError: theme.spacing is not a function]
Thank you for your help !
Hello,
I've an issue while reading the documentation of material-ui:
https://material-ui.com/guides/testing/#createmount-options-mount
I can't fully understand how to write my tests with custom styles and with this exemple:
Here is some questions:
MyComponentshould be mounted ?While testing, I ran into this issue:
Error: Uncaught [TypeError: theme.spacing is not a function]Thank you for your help !