UNPKG

1.09 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import { render as enzymeRender } from 'enzyme';
4import * as React from 'react';
5import { RenderContext } from './RenderMode';
6let warnedOnce = false;
7/**
8 * Generate a render to string function.
9 * @deprecated to remvoe in v5
10 */
11
12export default function createRender(options1 = {}) {
13 if (!warnedOnce) {
14 warnedOnce = true;
15 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'));
16 }
17
18 const {
19 render = enzymeRender
20 } = options1,
21 other1 = _objectWithoutPropertiesLoose(options1, ["render"]);
22
23 const renderWithContext = function renderWithContext(node, options2 = {}) {
24 return render( /*#__PURE__*/React.createElement(RenderContext, null, node), _extends({}, other1, options2));
25 };
26
27 return renderWithContext;
28}
\No newline at end of file