1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 |
|
4 | function shallowRecursively(wrapper, selector, _ref) {
|
5 | let {
|
6 | context
|
7 | } = _ref,
|
8 | other = _objectWithoutPropertiesLoose(_ref, ["context"]);
|
9 |
|
10 | if (wrapper.isEmptyRender() || typeof wrapper.getElement().type === 'string') {
|
11 | return wrapper;
|
12 | }
|
13 |
|
14 | let newContext = context;
|
15 | const instance = wrapper.root().instance();
|
16 |
|
17 | if (instance && instance.getChildContext) {
|
18 | newContext = _extends({}, context, instance.getChildContext());
|
19 | }
|
20 |
|
21 | const nextWrapper = wrapper.shallow(_extends({
|
22 | context: newContext
|
23 | }, other));
|
24 |
|
25 | if (selector && wrapper.is(selector)) {
|
26 | return nextWrapper;
|
27 | }
|
28 |
|
29 | return shallowRecursively(nextWrapper, selector, {
|
30 | context: newContext
|
31 | });
|
32 | }
|
33 |
|
34 | let warnedOnce = false;
|
35 | export default function until(selector, options = {}) {
|
36 | if (!warnedOnce) {
|
37 | warnedOnce = true;
|
38 | 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'));
|
39 | }
|
40 |
|
41 | return this.single('until', () => shallowRecursively(this, selector, options));
|
42 | } |
\ | No newline at end of file |