-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Labels
breaking changeIntroduces changes that are not backward compatible.Introduces changes that are not backward compatible.docsImprovements or additions to the documentation.Improvements or additions to the documentation.test
Milestone
Description
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
MyComponentshould 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 !
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changeIntroduces changes that are not backward compatible.Introduces changes that are not backward compatible.docsImprovements or additions to the documentation.Improvements or additions to the documentation.test