UNPKG

762 BJavaScriptView Raw
1import * as React from 'react';
2import createShallow from './createShallow';
3const shallow = createShallow();
4let warnedOnce = false; // Helper function to extract the classes from a styleSheet.
5
6export default function getClasses(element) {
7 if (!warnedOnce) {
8 warnedOnce = true;
9 console.warn(['Material-UI: the test utils are deprecated, they are no longer present in v5.', 'The helpers were designed to work with enzyme.', 'However, the tests of the core components were moved to react-testing-library.'].join('\n'));
10 }
11
12 const {
13 useStyles
14 } = element.type;
15 let classes;
16
17 function Listener() {
18 classes = useStyles(element.props);
19 return null;
20 }
21
22 shallow( /*#__PURE__*/React.createElement(Listener, null));
23 return classes;
24}
\No newline at end of file