Use public API in tests wherever possible (#9954)
* Use public API in tests wherever possible * Add missing src/node_modules files
Dan Abramov committed
Jun 14, 2017 at 00:58 UTC
4f19558c6be68abfab85b3ab2e8a3d3efabaa700
86 files changed
+159
-81
src/isomorphic/children/__tests__/ReactChildren-test.js
+1
-1
@@ -25,7 +25,7 @@ describe('ReactChildren', () => {
25
beforeEach(() => {
26
jest.resetModules();
27
React = require('react');
28
- ReactTestUtils = require('ReactTestUtils');
28
+ ReactTestUtils = require('react-dom/test-utils');
29
});
30
31
it('should support identity for simple', () => {
src/isomorphic/children/__tests__/onlyChild-test.js
+7
-9
@@ -13,17 +13,15 @@
13
14
describe('onlyChild', () => {
15
var React;
16
- var onlyChild;
16
var WrapComponent;
17
18
beforeEach(() => {
19
React = require('react');
21
- onlyChild = require('onlyChild');
20
WrapComponent = class extends React.Component {
21
render() {
22
return (
23
<div>
26
- {onlyChild(this.props.children, this.props.mapFn, this)}
24
+ {React.Children.only(this.props.children, this.props.mapFn, this)}
25
</div>
26
);
27
}
@@ -38,7 +36,7 @@ describe('onlyChild', () => {
36
<span />
37
</WrapComponent>
38
);
41
- onlyChild(instance.props.children);
39
+ React.Children.only(instance.props.children);
40
}).toThrow();
41
});
42
@@ -49,7 +47,7 @@ describe('onlyChild', () => {
47
{null}
48
</WrapComponent>
49
);
52
- onlyChild(instance.props.children);
50
+ React.Children.only(instance.props.children);
51
}).toThrow();
52
53
expect(function() {
@@ -58,7 +56,7 @@ describe('onlyChild', () => {
56
{undefined}
57
</WrapComponent>
58
);
61
- onlyChild(instance.props.children);
59
+ React.Children.only(instance.props.children);
60
}).toThrow();
61
});
62
@@ -69,7 +67,7 @@ describe('onlyChild', () => {
67
{[<span key="abc" />]}
68
</WrapComponent>
69
);
72
- onlyChild(instance.props.children);
70
+ React.Children.only(instance.props.children);
71
}).toThrow();
72
});
73
@@ -80,7 +78,7 @@ describe('onlyChild', () => {
78
{<span />}
79
</WrapComponent>
80
);
83
- onlyChild(instance.props.children);
81
+ React.Children.only(instance.props.children);
82
}).not.toThrow();
83
});
84
@@ -90,6 +88,6 @@ describe('onlyChild', () => {
88
<span />
89
</WrapComponent>
90
);
93
- expect(onlyChild(instance.props.children)).toEqual(<span />);
91
+ expect(React.Children.only(instance.props.children)).toEqual(<span />);
92
});
93
});
src/isomorphic/classic/__tests__/ReactContextValidator-test.js
+1
-1
@@ -33,7 +33,7 @@ describe('ReactContextValidator', () => {
33
PropTypes = require('prop-types');
34
React = require('react');
35
ReactDOM = require('react-dom');
36
- ReactTestUtils = require('ReactTestUtils');
36
+ ReactTestUtils = require('react-dom/test-utils');
37
});
38
39
// TODO: This behavior creates a runtime dependency on propTypes. We should
src/isomorphic/classic/__tests__/createReactClassIntegration-test.js
+1
-1
@@ -22,7 +22,7 @@ describe('create-react-class-integration', () => {
22
PropTypes = require('prop-types');
23
React = require('react');
24
ReactDOM = require('react-dom');
25
- ReactTestUtils = require('ReactTestUtils');
25
+ ReactTestUtils = require('react-dom/test-utils');
26
createReactClass = require('create-react-class/factory')(
27
React.Component,
28
React.isValidElement,
src/isomorphic/classic/element/__tests__/ReactElement-test.js
+1
-1
@@ -30,7 +30,7 @@ describe('ReactElement', () => {
30
31
React = require('react');
32
ReactDOM = require('react-dom');
33
- ReactTestUtils = require('ReactTestUtils');
33
+ ReactTestUtils = require('react-dom/test-utils');
34
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
35
// NOTE: We're explicitly not using JSX here. This is intended to test
36
// classic JS without JSX.
src/isomorphic/classic/element/__tests__/ReactElementClone-test.js
+1
-1
@@ -23,7 +23,7 @@ describe('ReactElementClone', () => {
23
PropTypes = require('prop-types');
24
React = require('react');
25
ReactDOM = require('react-dom');
26
- ReactTestUtils = require('ReactTestUtils');
26
+ ReactTestUtils = require('react-dom/test-utils');
27
28
// NOTE: We're explicitly not using JSX here. This is intended to test
29
// classic JS without JSX.
src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js
+1
-1
@@ -32,7 +32,7 @@ describe('ReactElementValidator', () => {
32
PropTypes = require('prop-types');
33
React = require('react');
34
ReactDOM = require('react-dom');
35
- ReactTestUtils = require('ReactTestUtils');
35
+ ReactTestUtils = require('react-dom/test-utils');
36
ComponentClass = class extends React.Component {
37
render() {
38
return React.createElement('div');
src/isomorphic/modern/element/__tests__/ReactJSXElement-test.js
+1
-1
@@ -23,7 +23,7 @@ describe('ReactJSXElement', () => {
23
24
React = require('react');
25
ReactDOM = require('react-dom');
26
- ReactTestUtils = require('ReactTestUtils');
26
+ ReactTestUtils = require('react-dom/test-utils');
27
Component = class extends React.Component {
28
render() {
29
return <div />;
src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js
+1
-1
@@ -33,7 +33,7 @@ describe('ReactJSXElementValidator', () => {
33
PropTypes = require('prop-types');
34
React = require('react');
35
ReactDOM = require('react-dom');
36
- ReactTestUtils = require('ReactTestUtils');
36
+ ReactTestUtils = require('react-dom/test-utils');
37
38
Component = class extends React.Component {
39
render() {
src/node_modules/react-art/index.js
new
+9
@@ -0,0 +1,9 @@
1
+/**
2
+ * Copyright 2016-present Facebook. All Rights Reserved.
3
+ *
4
+ * @flow
5
+ */
6
+
7
+'use strict';
8
+
9
+module.exports = require('ReactARTFiber');
src/node_modules/react-dom/test-utils.js
new
+9
@@ -0,0 +1,9 @@
1
+/**
2
+ * Copyright 2016-present Facebook. All Rights Reserved.
3
+ *
4
+ * @flow
5
+ */
6
+
7
+'use strict';
8
+
9
+module.exports = require('ReactTestUtils');
src/node_modules/react-native/index.js
new
+9
@@ -0,0 +1,9 @@
1
+/**
2
+ * Copyright 2016-present Facebook. All Rights Reserved.
3
+ *
4
+ * @flow
5
+ */
6
+
7
+'use strict';
8
+
9
+module.exports = require('ReactNative');
src/node_modules/react-noop-renderer/index.js
new
+9
@@ -0,0 +1,9 @@
1
+/**
2
+ * Copyright 2016-present Facebook. All Rights Reserved.
3
+ *
4
+ * @flow
5
+ */
6
+
7
+'use strict';
8
+
9
+module.exports = require('ReactNoop');
src/node_modules/react-test-renderer/shallow.js
new
+9
@@ -0,0 +1,9 @@
1
+/**
2
+ * Copyright 2016-present Facebook. All Rights Reserved.
3
+ *
4
+ * @flow
5
+ */
6
+
7
+'use strict';
8
+
9
+module.exports = require('ReactShallowRenderer');
src/renderers/__tests__/EventPluginHub-test.js
+1
-1
@@ -20,7 +20,7 @@ describe('EventPluginHub', () => {
20
beforeEach(() => {
21
jest.resetModules();
22
React = require('react');
23
- ReactTestUtils = require('ReactTestUtils');
23
+ ReactTestUtils = require('react-dom/test-utils');
24
});
25
26
it('should prevent non-function listeners, at dispatch', () => {
src/renderers/__tests__/ReactChildReconciler-test.js
+1
-1
@@ -26,7 +26,7 @@ describe('ReactChildReconciler', () => {
26
jest.resetModules();
27
28
React = require('react');
29
- ReactTestUtils = require('ReactTestUtils');
29
+ ReactTestUtils = require('react-dom/test-utils');
30
});
31
32
function createIterable(array) {
src/renderers/__tests__/ReactComponent-test.js
+1
-1
@@ -25,7 +25,7 @@ describe('ReactComponent', () => {
25
React = require('react');
26
ReactDOM = require('react-dom');
27
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
28
- ReactTestUtils = require('ReactTestUtils');
28
+ ReactTestUtils = require('react-dom/test-utils');
29
});
30
31
it('should throw on invalid render targets', () => {
src/renderers/__tests__/ReactComponentLifeCycle-test.js
+1
-1
@@ -91,7 +91,7 @@ describe('ReactComponentLifeCycle', () => {
91
jest.resetModules();
92
React = require('react');
93
ReactDOM = require('react-dom');
94
- ReactTestUtils = require('ReactTestUtils');
94
+ ReactTestUtils = require('react-dom/test-utils');
95
PropTypes = require('prop-types');
96
});
97
src/renderers/__tests__/ReactCompositeComponent-test.js
+3
-2
@@ -28,8 +28,9 @@ describe('ReactCompositeComponent', () => {
28
React = require('react');
29
ReactDOM = require('react-dom');
30
ReactDOMServer = require('react-dom/server');
31
- ReactCurrentOwner = require('ReactCurrentOwner');
32
- ReactTestUtils = require('ReactTestUtils');
31
+ ReactCurrentOwner = require('react')
32
+ .__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
33
+ ReactTestUtils = require('react-dom/test-utils');
34
PropTypes = require('prop-types');
35
shallowEqual = require('fbjs/lib/shallowEqual');
36
src/renderers/__tests__/ReactCompositeComponentDOMMinimalism-test.js
+1
-1
@@ -31,7 +31,7 @@ describe('ReactCompositeComponentDOMMinimalism', () => {
31
beforeEach(() => {
32
React = require('react');
33
ReactDOM = require('react-dom');
34
- ReactTestUtils = require('ReactTestUtils');
34
+ ReactTestUtils = require('react-dom/test-utils');
35
36
LowerLevelComposite = class extends React.Component {
37
render() {
src/renderers/__tests__/ReactCompositeComponentNestedState-test.js
+1
-1
@@ -19,7 +19,7 @@ describe('ReactCompositeComponentNestedState-state', () => {
19
beforeEach(() => {
20
React = require('react');
21
ReactDOM = require('react-dom');
22
- ReactTestUtils = require('ReactTestUtils');
22
+ ReactTestUtils = require('react-dom/test-utils');
23
});
24
25
it('should provide up to date values for props', () => {
src/renderers/__tests__/ReactEmptyComponent-test.js
+1
-1
@@ -26,7 +26,7 @@ describe('ReactEmptyComponent', () => {
26
React = require('react');
27
ReactDOM = require('react-dom');
28
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
29
- ReactTestUtils = require('ReactTestUtils');
29
+ ReactTestUtils = require('react-dom/test-utils');
30
31
log = jasmine.createSpy();
32
src/renderers/__tests__/ReactIdentity-test.js
+1
-1
@@ -20,7 +20,7 @@ describe('ReactIdentity', () => {
20
jest.resetModules();
21
React = require('react');
22
ReactDOM = require('react-dom');
23
- ReactTestUtils = require('ReactTestUtils');
23
+ ReactTestUtils = require('react-dom/test-utils');
24
});
25
26
it('should allow key property to express identity', () => {
src/renderers/__tests__/ReactMockedComponent-test.js
+2
-2
@@ -21,8 +21,8 @@ var ReactDOMServer;
21
describe('ReactMockedComponent', () => {
22
beforeEach(() => {
23
React = require('react');
24
- ReactTestUtils = require('ReactTestUtils');
25
- ReactDOMServer = require('ReactDOMServer');
24
+ ReactTestUtils = require('react-dom/test-utils');
25
+ ReactDOMServer = require('react-dom/server');
26
27
AutoMockedComponent = jest.genMockFromModule(
28
'ReactMockedComponentTestComponent',
src/renderers/__tests__/ReactMultiChildText-test.js
+1
-1
@@ -14,7 +14,7 @@
14
var React = require('react');
15
var ReactDOM = require('react-dom');
16
var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
17
-var ReactTestUtils = require('ReactTestUtils');
17
+var ReactTestUtils = require('react-dom/test-utils');
18
19
// Helpers
20
var testAllPermutations = function(testCases) {
src/renderers/__tests__/ReactTreeTraversal-test.js
+2
-1
@@ -12,8 +12,9 @@
12
'use strict';
13
14
var React = require('react');
15
+// TODO: can we express this test with only public API?
16
var ReactDOMComponentTree = require('ReactDOMComponentTree');
16
-var ReactTestUtils = require('ReactTestUtils');
17
+var ReactTestUtils = require('react-dom/test-utils');
18
19
/**
20
* Ensure that all callbacks are invoked, passing this unique argument.
src/renderers/__tests__/ReactUpdates-test.js
+1
-1
@@ -21,7 +21,7 @@ describe('ReactUpdates', () => {
21
React = require('react');
22
ReactDOM = require('react-dom');
23
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
24
- ReactTestUtils = require('ReactTestUtils');
24
+ ReactTestUtils = require('react-dom/test-utils');
25
});
26
27
it('should batch state when updating state twice', () => {
src/renderers/__tests__/refs-destruction-test.js
+1
-1
@@ -23,7 +23,7 @@ describe('refs-destruction', () => {
23
24
React = require('react');
25
ReactDOM = require('react-dom');
26
- ReactTestUtils = require('ReactTestUtils');
26
+ ReactTestUtils = require('react-dom/test-utils');
27
28
TestComponent = class extends React.Component {
29
render() {
src/renderers/__tests__/refs-test.js
+1
-1
@@ -13,7 +13,7 @@
13
14
var React = require('react');
15
var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
16
-var ReactTestUtils = require('ReactTestUtils');
16
+var ReactTestUtils = require('react-dom/test-utils');
17
18
/**
19
* Counts clicks and has a renders an item for each click. Each item rendered
src/renderers/art/__tests__/ReactART-test.js
+2
-2
@@ -15,7 +15,7 @@
15
16
var React = require('react');
17
var ReactDOM = require('react-dom');
18
-var ReactTestUtils = require('ReactTestUtils');
18
+var ReactTestUtils = require('react-dom/test-utils');
19
20
var Group;
21
var Shape;
@@ -24,7 +24,7 @@ var TestComponent;
24
25
var Missing = {};
26
27
-var ReactART = require('ReactARTFiber');
27
+var ReactART = require('react-art');
28
var ARTSVGMode = require('art/modes/svg');
29
var ARTCurrentMode = require('art/modes/current');
30
src/renderers/dom/fiber/__tests__/ReactDOMFiber-test.js
+1
-1
@@ -14,7 +14,7 @@
14
var React = require('react');
15
var ReactDOM = require('react-dom');
16
var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
17
-var ReactTestUtils = require('ReactTestUtils');
17
+var ReactTestUtils = require('react-dom/test-utils');
18
var PropTypes = require('prop-types');
19
20
describe('ReactDOMFiber', () => {
src/renderers/dom/shared/__tests__/CSSProperty-test.js
+1
@@ -16,6 +16,7 @@ describe('CSSProperty', () => {
16
17
beforeEach(() => {
18
jest.resetModules();
19
+ // TODO: can we express this test with only public API?
20
CSSProperty = require('CSSProperty');
21
});
22
src/renderers/dom/shared/__tests__/DOMPropertyOperations-test.js
+1
@@ -21,6 +21,7 @@ describe('DOMPropertyOperations', () => {
21
var ReactDOMInjection = require('ReactDOMInjection');
22
ReactDOMInjection.inject();
23
24
+ // TODO: can we express this test with only public API?
25
DOMPropertyOperations = require('DOMPropertyOperations');
26
DOMProperty = require('DOMProperty');
27
ReactDOMComponentTree = require('ReactDOMComponentTree');
src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js
+2
-1
@@ -60,13 +60,14 @@ describe('ReactBrowserEventEmitter', () => {
60
jest.resetModules();
61
LISTENER.mockClear();
62
EventListener = require('fbjs/lib/EventListener');
63
+ // TODO: can we express this test with only public API?
64
EventPluginHub = require('EventPluginHub');
65
EventPluginRegistry = require('EventPluginRegistry');
66
React = require('react');
67
ReactDOM = require('react-dom');
68
ReactDOMComponentTree = require('ReactDOMComponentTree');
69
ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');
69
- ReactTestUtils = require('ReactTestUtils');
70
+ ReactTestUtils = require('react-dom/test-utils');
71
TapEventPlugin = require('TapEventPlugin');
72
73
var container = document.createElement('div');
src/renderers/dom/shared/__tests__/ReactDOM-test.js
+1
-1
@@ -13,7 +13,7 @@
13
14
var React = require('react');
15
var ReactDOM = require('react-dom');
16
-var ReactTestUtils = require('ReactTestUtils');
16
+var ReactTestUtils = require('react-dom/test-utils');
17
18
describe('ReactDOM', () => {
19
// TODO: uncomment this test once we can run in phantom, which
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+2
-1
@@ -29,7 +29,8 @@ describe('ReactDOMComponent', () => {
29
ReactDOM = require('react-dom');
30
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
31
ReactDOMServer = require('react-dom/server');
32
- ReactTestUtils = require('ReactTestUtils');
32
+ ReactTestUtils = require('react-dom/test-utils');
33
+ // TODO: can we express this test with only public API?
34
inputValueTracking = require('inputValueTracking');
35
});
36
src/renderers/dom/shared/__tests__/ReactDOMComponentTree-test.js
+1
@@ -41,6 +41,7 @@ describe('ReactDOMComponentTree', () => {
41
beforeEach(() => {
42
React = require('react');
43
ReactDOM = require('react-dom');
44
+ // TODO: can we express this test with only public API?
45
ReactDOMComponentTree = require('ReactDOMComponentTree');
46
ReactDOMServer = require('react-dom/server');
47
});
src/renderers/dom/shared/__tests__/ReactDOMEventListener-test.js
+2
-1
@@ -25,9 +25,10 @@ describe('ReactDOMEventListener', () => {
25
jest.resetModules();
26
React = require('react');
27
ReactDOM = require('react-dom');
28
+ // TODO: can we express this test with only public API?
29
ReactDOMComponentTree = require('ReactDOMComponentTree');
30
ReactDOMEventListener = require('ReactDOMEventListener');
30
- ReactTestUtils = require('ReactTestUtils');
31
+ ReactTestUtils = require('react-dom/test-utils');
32
33
handleTopLevel = jest.fn();
34
ReactDOMEventListener._handleTopLevel = handleTopLevel;
src/renderers/dom/shared/__tests__/ReactDOMInvalidARIAHook-test.js
+1
-1
@@ -19,7 +19,7 @@ describe('ReactDOMInvalidARIAHook', () => {
19
beforeEach(() => {
20
jest.resetModules();
21
React = require('react');
22
- ReactTestUtils = require('ReactTestUtils');
22
+ ReactTestUtils = require('react-dom/test-utils');
23
24
mountComponent = function(props) {
25
ReactTestUtils.renderIntoDocument(<div {...props} />);
src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
+5
-4
@@ -242,11 +242,12 @@ function expectMarkupMismatch(serverElement, clientElement) {
242
function resetModules() {
243
jest.resetModuleRegistry();
244
PropTypes = require('prop-types');
245
- React = require('React');
246
- ReactDOM = require('ReactDOM');
247
- ReactDOMServer = require('ReactDOMServer');
245
+ React = require('react');
246
+ ReactDOM = require('react-dom');
247
+ ReactDOMServer = require('react-dom/server');
248
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
249
- ReactTestUtils = require('ReactTestUtils');
249
+ ReactTestUtils = require('react-dom/test-utils');
250
+ // TODO: can we express this test with only public API?
251
ExecutionEnvironment = require('ExecutionEnvironment');
252
}
253
src/renderers/dom/shared/__tests__/ReactEventIndependence-test.js
+1
-1
@@ -21,7 +21,7 @@ describe('ReactEventIndependence', () => {
21
22
React = require('react');
23
ReactDOM = require('react-dom');
24
- ReactTestUtils = require('ReactTestUtils');
24
+ ReactTestUtils = require('react-dom/test-utils');
25
});
26
27
it('does not crash with other react inside', () => {
src/renderers/dom/shared/__tests__/ReactMount-test.js
+1
-1
@@ -24,7 +24,7 @@ describe('ReactMount', () => {
24
React = require('react');
25
ReactDOM = require('react-dom');
26
ReactDOMServer = require('react-dom/server');
27
- ReactTestUtils = require('ReactTestUtils');
27
+ ReactTestUtils = require('react-dom/test-utils');
28
29
try {
30
if (WebComponents === undefined && typeof jest !== 'undefined') {
src/renderers/dom/shared/__tests__/ReactServerRendering-test.js
+1
-1
@@ -29,9 +29,9 @@ describe('ReactDOMServer', () => {
29
jest.resetModules();
30
React = require('react');
31
ReactDOM = require('react-dom');
32
+ ReactTestUtils = require('react-dom/test-utils');
33
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
34
ReactMarkupChecksum = require('ReactMarkupChecksum');
34
- ReactTestUtils = require('ReactTestUtils');
35
ReactReconcileTransaction = require('ReactReconcileTransaction');
36
PropTypes = require('prop-types');
37
src/renderers/dom/shared/__tests__/escapeTextContentForBrowser-test.js
+1
@@ -12,6 +12,7 @@
12
'use strict';
13
14
describe('escapeTextContentForBrowser', () => {
15
+ // TODO: can we express this test with only public API?
16
var escapeTextContentForBrowser = require('escapeTextContentForBrowser');
17
18
it('should escape boolean to string', () => {
src/renderers/dom/shared/__tests__/findDOMNode-test.js
+1
-1
@@ -13,7 +13,7 @@
13
14
var React = require('react');
15
var ReactDOM = require('react-dom');
16
-var ReactTestUtils = require('ReactTestUtils');
16
+var ReactTestUtils = require('react-dom/test-utils');
17
18
describe('findDOMNode', () => {
19
it('findDOMNode should return null if passed null', () => {
src/renderers/dom/shared/__tests__/inputValueTracking-test.js
+1
@@ -13,6 +13,7 @@
13
14
var React = require('react');
15
var ReactTestUtils = require('ReactTestUtils');
16
+// TODO: can we express this test with only public API?
17
var inputValueTracking = require('inputValueTracking');
18
19
describe('inputValueTracking', () => {
src/renderers/dom/shared/__tests__/quoteAttributeValueForBrowser-test.js
+1
@@ -12,6 +12,7 @@
12
'use strict';
13
14
describe('quoteAttributeValueForBrowser', () => {
15
+ // TODO: can we express this test with only public API?
16
var quoteAttributeValueForBrowser = require('quoteAttributeValueForBrowser');
17
18
it('should escape boolean to string', () => {
src/renderers/dom/shared/__tests__/renderSubtreeIntoContainer-test.js
+3
-2
@@ -14,8 +14,9 @@
14
var React = require('react');
15
var PropTypes = require('prop-types');
16
var ReactDOM = require('react-dom');
17
-var ReactTestUtils = require('ReactTestUtils');
18
-var renderSubtreeIntoContainer = require('renderSubtreeIntoContainer');
17
+var ReactTestUtils = require('react-dom/test-utils');
18
+var renderSubtreeIntoContainer = require('react-dom')
19
+ .unstable_renderSubtreeIntoContainer;
20
21
describe('renderSubtreeIntoContainer', () => {
22
it('should pass context when rendering subtree elsewhere', () => {
src/renderers/dom/shared/__tests__/validateDOMNesting-test.js
+1
@@ -137,6 +137,7 @@ describe('ReactContextValidator', () => {
137
beforeEach(() => {
138
jest.resetModules();
139
140
+ // TODO: can we express this test with only public API?
141
validateDOMNesting = require('validateDOMNesting');
142
});
143
src/renderers/dom/shared/eventPlugins/__tests__/BeforeInputEventPlugin-test.js
+2
@@ -48,6 +48,8 @@ describe('BeforeInputEventPlugin', function() {
48
// Modules which have dependency on BeforeInputEventPlugin are stored
49
// in ModuleCache so that we can use these modules ouside test functions.
50
this.ReactDOM = require('react-dom');
51
+
52
+ // TODO: can we express this test with only public API?
53
this.ReactDOMComponentTree = require('ReactDOMComponentTree');
54
this.SyntheticCompositionEvent = require('SyntheticCompositionEvent');
55
this.SyntheticInputEvent = require('SyntheticInputEvent');
src/renderers/dom/shared/eventPlugins/__tests__/ChangeEventPlugin-test.js
+2
-1
@@ -13,7 +13,8 @@
13
14
var React = require('react');
15
var ReactDOM = require('react-dom');
16
-var ReactTestUtils = require('ReactTestUtils');
16
+var ReactTestUtils = require('react-dom/test-utils');
17
+// TODO: can we express this test with only public API?
18
var ChangeEventPlugin = require('ChangeEventPlugin');
19
var inputValueTracking = require('inputValueTracking');
20
src/renderers/dom/shared/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js
+2
-1
@@ -20,10 +20,11 @@ describe('EnterLeaveEventPlugin', () => {
20
beforeEach(() => {
21
jest.resetModules();
22
23
- EnterLeaveEventPlugin = require('EnterLeaveEventPlugin');
23
React = require('react');
24
ReactDOM = require('react-dom');
25
+ // TODO: can we express this test with only public API?
26
ReactDOMComponentTree = require('ReactDOMComponentTree');
27
+ EnterLeaveEventPlugin = require('EnterLeaveEventPlugin');
28
});
29
30
it('should set relatedTarget properly in iframe', () => {
src/renderers/dom/shared/eventPlugins/__tests__/FallbackCompositionState-test.js
+1
@@ -17,6 +17,7 @@ describe('FallbackCompositionState', () => {
17
var TEXT = 'Hello world';
18
19
beforeEach(() => {
20
+ // TODO: can we express this test with only public API?
21
FallbackCompositionState = require('FallbackCompositionState');
22
});
23
src/renderers/dom/shared/eventPlugins/__tests__/SelectEventPlugin-test.js
+2
-1
@@ -30,8 +30,9 @@ describe('SelectEventPlugin', () => {
30
beforeEach(() => {
31
React = require('react');
32
ReactDOM = require('react-dom');
33
+ ReactTestUtils = require('react-dom/test-utils');
34
+ // TODO: can we express this test with only public API?
35
ReactDOMComponentTree = require('ReactDOMComponentTree');
34
- ReactTestUtils = require('ReactTestUtils');
36
SelectEventPlugin = require('SelectEventPlugin');
37
});
38
src/renderers/dom/shared/eventPlugins/__tests__/SimpleEventPlugin-test.js
+1
-1
@@ -36,7 +36,7 @@ describe('SimpleEventPlugin', function() {
36
beforeEach(function() {
37
React = require('react');
38
ReactDOM = require('react-dom');
39
- ReactTestUtils = require('ReactTestUtils');
39
+ ReactTestUtils = require('react-dom/test-utils');
40
41
onClick = jest.fn();
42
});
src/renderers/dom/shared/syntheticEvents/__tests__/SyntheticClipboardEvent-test.js
+1
@@ -17,6 +17,7 @@ describe('SyntheticClipboardEvent', () => {
17
var createEvent;
18
19
beforeEach(() => {
20
+ // TODO: can we express this test with only public API?
21
SyntheticClipboardEvent = require('SyntheticClipboardEvent');
22
createEvent = function(nativeEvent) {
23
var target = require('getEventTarget')(nativeEvent);
src/renderers/dom/shared/syntheticEvents/__tests__/SyntheticEvent-test.js
+2
-1
@@ -20,10 +20,11 @@ describe('SyntheticEvent', () => {
20
var createEvent;
21
22
beforeEach(() => {
23
+ // TODO: can we express this test with only public API?
24
SyntheticEvent = require('SyntheticEvent');
25
React = require('react');
26
ReactDOM = require('react-dom');
26
- ReactTestUtils = require('ReactTestUtils');
27
+ ReactTestUtils = require('react-dom/test-utils');
28
29
createEvent = function(nativeEvent) {
30
var target = require('getEventTarget')(nativeEvent);
src/renderers/dom/shared/syntheticEvents/__tests__/SyntheticKeyboardEvent-test.js
+1
@@ -22,6 +22,7 @@ describe('SyntheticKeyboardEvent', () => {
22
jest.mock('getEventCharCode');
23
getEventCharCode = require('getEventCharCode');
24
25
+ // TODO: can we express this test with only public API?
26
SyntheticKeyboardEvent = require('SyntheticKeyboardEvent');
27
createEvent = function(nativeEvent) {
28
var target = require('getEventTarget')(nativeEvent);
src/renderers/dom/shared/syntheticEvents/__tests__/SyntheticWheelEvent-test.js
+1
@@ -17,6 +17,7 @@ describe('SyntheticWheelEvent', () => {
17
var createEvent;
18
19
beforeEach(() => {
20
+ // TODO: can we express this test with only public API?
21
SyntheticWheelEvent = require('SyntheticWheelEvent');
22
23
createEvent = function(nativeEvent) {
src/renderers/dom/shared/utils/__tests__/getEventCharCode-test.js
+1
@@ -11,6 +11,7 @@
11
12
'use strict';
13
14
+// TODO: can we express this test with only public API?
15
var getEventCharCode = require('getEventCharCode');
16
17
describe('getEventCharCode', () => {
src/renderers/dom/shared/utils/__tests__/getEventKey-test.js
+1
@@ -11,6 +11,7 @@
11
12
'use strict';
13
14
+// TODO: can we express this test with only public API?
15
var getEventKey = require('getEventKey');
16
17
describe('getEventKey', () => {
src/renderers/dom/shared/utils/__tests__/getNodeForCharacterOffset-test.js
+1
@@ -13,6 +13,7 @@
13
14
var getTestDocument = require('getTestDocument');
15
16
+// TODO: can we express this test with only public API?
17
var getNodeForCharacterOffset = require('getNodeForCharacterOffset');
18
19
// Create node from HTML string
src/renderers/dom/shared/utils/__tests__/setInnerHTML-test.js
+1
@@ -11,6 +11,7 @@
11
12
'use strict';
13
14
+// TODO: can we express this test with only public API?
15
var setInnerHTML = require('setInnerHTML');
16
var DOMNamespaces = require('DOMNamespaces');
17
src/renderers/dom/shared/wrappers/__tests__/ReactDOMIframe-test.js
+1
-1
@@ -19,7 +19,7 @@ describe('ReactDOMIframe', () => {
19
beforeEach(() => {
20
React = require('react');
21
ReactDOM = require('react-dom');
22
- ReactTestUtils = require('ReactTestUtils');
22
+ ReactTestUtils = require('react-dom/test-utils');
23
});
24
25
it('should trigger load events', () => {
src/renderers/dom/shared/wrappers/__tests__/ReactDOMInput-test.js
+2
-1
@@ -38,7 +38,8 @@ describe('ReactDOMInput', () => {
38
ReactDOM = require('react-dom');
39
ReactDOMServer = require('react-dom/server');
40
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
41
- ReactTestUtils = require('ReactTestUtils');
41
+ ReactTestUtils = require('react-dom/test-utils');
42
+ // TODO: can we express this test with only public API?
43
inputValueTracking = require('inputValueTracking');
44
spyOn(console, 'error');
45
});
src/renderers/dom/shared/wrappers/__tests__/ReactDOMOption-test.js
+1
-1
@@ -25,7 +25,7 @@ describe('ReactDOMOption', () => {
25
React = require('react');
26
ReactDOM = require('react-dom');
27
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
28
- ReactTestUtils = require('ReactTestUtils');
28
+ ReactTestUtils = require('react-dom/test-utils');
29
});
30
31
it('should flatten children to a string', () => {
src/renderers/dom/shared/wrappers/__tests__/ReactDOMSelect-test.js
+1
-1
@@ -23,7 +23,7 @@ describe('ReactDOMSelect', () => {
23
React = require('react');
24
ReactDOM = require('react-dom');
25
ReactDOMServer = require('react-dom/server');
26
- ReactTestUtils = require('ReactTestUtils');
26
+ ReactTestUtils = require('react-dom/test-utils');
27
});
28
29
it('should allow setting `defaultValue`', () => {
src/renderers/dom/shared/wrappers/__tests__/ReactDOMTextarea-test.js
+1
-1
@@ -25,7 +25,7 @@ describe('ReactDOMTextarea', () => {
25
React = require('react');
26
ReactDOM = require('react-dom');
27
ReactDOMServer = require('react-dom/server');
28
- ReactTestUtils = require('ReactTestUtils');
28
+ ReactTestUtils = require('react-dom/test-utils');
29
30
renderTextarea = function(component, container) {
31
if (!container) {
src/renderers/dom/test/__tests__/ReactTestUtils-test.js
+2
-2
@@ -20,12 +20,12 @@ let ReactTestUtils;
20
21
describe('ReactTestUtils', () => {
22
beforeEach(() => {
23
- createRenderer = require('ReactShallowRenderer').createRenderer;
23
+ createRenderer = require('react-test-renderer/shallow').createRenderer;
24
PropTypes = require('prop-types');
25
React = require('react');
26
ReactDOM = require('react-dom');
27
ReactDOMServer = require('react-dom/server');
28
- ReactTestUtils = require('ReactTestUtils');
28
+ ReactTestUtils = require('react-dom/test-utils');
29
});
30
31
it('should call all of the lifecycle hooks', () => {
src/renderers/native/__tests__/ReactNativeEvents-test.js
+1
-1
@@ -25,7 +25,7 @@ beforeEach(() => {
25
PropTypes = require('prop-types');
26
RCTEventEmitter = require('RCTEventEmitter');
27
React = require('react');
28
- ReactNative = require('ReactNative');
28
+ ReactNative = require('react-native');
29
ResponderEventPlugin = require('ResponderEventPlugin');
30
UIManager = require('UIManager');
31
createReactNativeComponentClass = require('createReactNativeComponentClass');
src/renderers/native/__tests__/ReactNativeMount-test.js
+1
-1
@@ -21,7 +21,7 @@ describe('ReactNative', () => {
21
jest.resetModules();
22
23
React = require('react');
24
- ReactNative = require('ReactNative');
24
+ ReactNative = require('react-native');
25
UIManager = require('UIManager');
26
createReactNativeComponentClass = require('createReactNativeComponentClass');
27
});
src/renderers/native/__tests__/createReactNativeComponentClass-test.js
+2
-2
@@ -21,8 +21,8 @@ describe('createReactNativeComponentClass', () => {
21
jest.resetModules();
22
23
createReactNativeComponentClass = require('createReactNativeComponentClass');
24
- React = require('React');
25
- ReactNative = require('ReactNative');
24
+ React = require('react');
25
+ ReactNative = require('react-native');
26
});
27
28
it('should register viewConfigs', () => {
src/renderers/shared/fiber/__tests__/ReactCoroutine-test.js
+2
-1
@@ -20,7 +20,8 @@ describe('ReactCoroutine', () => {
20
beforeEach(() => {
21
jest.resetModules();
22
React = require('react');
23
- ReactNoop = require('ReactNoop');
23
+ ReactNoop = require('react-noop-renderer');
24
+ // TODO: can we express this test with only public API?
25
ReactCoroutine = require('ReactCoroutine');
26
ReactFeatureFlags = require('ReactFeatureFlags');
27
ReactFeatureFlags.disableNewFiberFeatures = false;
src/renderers/shared/fiber/__tests__/ReactFiberHostContext-test.js
+2
-1
@@ -17,7 +17,8 @@ var ReactFiberReconciler;
17
describe('ReactFiberHostContext', () => {
18
beforeEach(() => {
19
jest.resetModules();
20
- React = require('React');
20
+ React = require('react');
21
+ // TODO: can we express this test with only public API?
22
ReactFiberReconciler = require('ReactFiberReconciler');
23
});
24
src/renderers/shared/fiber/__tests__/ReactIncremental-test.js
+1
-1
@@ -20,7 +20,7 @@ describe('ReactIncremental', () => {
20
beforeEach(() => {
21
jest.resetModules();
22
React = require('react');
23
- ReactNoop = require('ReactNoop');
23
+ ReactNoop = require('react-noop-renderer');
24
PropTypes = require('prop-types');
25
26
ReactFeatureFlags = require('ReactFeatureFlags');
src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js
+1
-1
@@ -21,7 +21,7 @@ describe('ReactIncrementalErrorHandling', () => {
21
jest.resetModules();
22
PropTypes = require('prop-types');
23
React = require('react');
24
- ReactNoop = require('ReactNoop');
24
+ ReactNoop = require('react-noop-renderer');
25
ReactFeatureFlags = require('ReactFeatureFlags');
26
ReactFeatureFlags.disableNewFiberFeatures = false;
27
});
src/renderers/shared/fiber/__tests__/ReactIncrementalPerf-test.js
+4
-3
@@ -116,11 +116,12 @@ describe('ReactDebugFiberPerf', () => {
116
global.performance = createUserTimingPolyfill();
117
118
// Import after the polyfill is set up:
119
- React = require('React');
119
+ React = require('react');
120
+ ReactNoop = require('react-noop-renderer');
121
+ // TODO: can we express this test with only public API?
122
ReactCoroutine = require('ReactCoroutine');
121
- ReactFeatureFlags = require('ReactFeatureFlags');
122
- ReactNoop = require('ReactNoop');
123
ReactPortal = require('ReactPortal');
124
+ ReactFeatureFlags = require('ReactFeatureFlags');
125
ReactFeatureFlags.disableNewFiberFeatures = false;
126
PropTypes = require('prop-types');
127
});
src/renderers/shared/fiber/__tests__/ReactIncrementalReflection-test.js
+1
-1
@@ -19,7 +19,7 @@ describe('ReactIncrementalReflection', () => {
19
beforeEach(() => {
20
jest.resetModules();
21
React = require('react');
22
- ReactNoop = require('ReactNoop');
22
+ ReactNoop = require('react-noop-renderer');
23
ReactFeatureFlags = require('ReactFeatureFlags');
24
ReactFeatureFlags.disableNewFiberFeatures = false;
25
});
src/renderers/shared/fiber/__tests__/ReactIncrementalScheduling-test.js
+1
-1
@@ -19,7 +19,7 @@ describe('ReactIncrementalScheduling', () => {
19
beforeEach(() => {
20
jest.resetModules();
21
React = require('react');
22
- ReactNoop = require('ReactNoop');
22
+ ReactNoop = require('react-noop-renderer');
23
ReactFeatureFlags = require('ReactFeatureFlags');
24
ReactFeatureFlags.disableNewFiberFeatures = false;
25
});
src/renderers/shared/fiber/__tests__/ReactIncrementalSideEffects-test.js
+1
-1
@@ -19,7 +19,7 @@ describe('ReactIncrementalSideEffects', () => {
19
beforeEach(() => {
20
jest.resetModules();
21
React = require('react');
22
- ReactNoop = require('ReactNoop');
22
+ ReactNoop = require('react-noop-renderer');
23
ReactFeatureFlags = require('ReactFeatureFlags');
24
ReactFeatureFlags.disableNewFiberFeatures = false;
25
});
src/renderers/shared/fiber/__tests__/ReactIncrementalUpdates-test.js
+1
-1
@@ -19,7 +19,7 @@ describe('ReactIncrementalUpdates', () => {
19
beforeEach(() => {
20
jest.resetModuleRegistry();
21
React = require('react');
22
- ReactNoop = require('ReactNoop');
22
+ ReactNoop = require('react-noop-renderer');
23
ReactFeatureFlags = require('ReactFeatureFlags');
24
ReactFeatureFlags.disableNewFiberFeatures = false;
25
});
src/renderers/shared/fiber/__tests__/ReactTopLevelFragment-test.js
+1
-1
@@ -21,7 +21,7 @@ describe('ReactTopLevelFragment', function() {
21
beforeEach(function() {
22
jest.resetModules();
23
React = require('react');
24
- ReactNoop = require('ReactNoop');
24
+ ReactNoop = require('react-noop-renderer');
25
ReactFeatureFlags = require('ReactFeatureFlags');
26
ReactFeatureFlags.disableNewFiberFeatures = false;
27
});
src/renderers/shared/fiber/__tests__/ReactTopLevelText-test.js
+1
-1
@@ -21,7 +21,7 @@ describe('ReactTopLevelText', () => {
21
beforeEach(() => {
22
jest.resetModules();
23
React = require('react');
24
- ReactNoop = require('ReactNoop');
24
+ ReactNoop = require('react-noop-renderer');
25
ReactFeatureFlags = require('ReactFeatureFlags');
26
ReactFeatureFlags.disableNewFiberFeatures = false;
27
});
src/renderers/shared/shared/event/__tests__/EventPluginRegistry-test.js
+1
@@ -17,6 +17,7 @@ describe('EventPluginRegistry', () => {
17
18
beforeEach(() => {
19
jest.resetModuleRegistry();
20
+ // TODO: can we express this test with only public API?
21
EventPluginRegistry = require('EventPluginRegistry');
22
23
createPlugin = function(properties) {
src/renderers/shared/shared/event/eventPlugins/__tests__/ResponderEventPlugin-test.js
+1
@@ -383,6 +383,7 @@ describe('ResponderEventPlugin', () => {
383
beforeEach(() => {
384
jest.resetModules();
385
386
+ // TODO: can we express this test with only public API?
387
EventPluginHub = require('EventPluginHub');
388
EventPluginUtils = require('EventPluginUtils');
389
ResponderEventPlugin = require('ResponderEventPlugin');
src/renderers/shared/utils/__tests__/ReactErrorUtils-test.js
+1
@@ -15,6 +15,7 @@ var ReactErrorUtils;
15
16
describe('ReactErrorUtils', () => {
17
beforeEach(() => {
18
+ // TODO: can we express this test with only public API?
19
ReactErrorUtils = require('ReactErrorUtils');
20
});
21