mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Use public API in tests wherever possible (#9954)
* Use public API in tests wherever possible * Add missing src/node_modules files
This commit is contained in:
@@ -25,7 +25,7 @@ describe('ReactChildren', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should support identity for simple', () => {
|
||||
|
||||
@@ -13,17 +13,15 @@
|
||||
|
||||
describe('onlyChild', () => {
|
||||
var React;
|
||||
var onlyChild;
|
||||
var WrapComponent;
|
||||
|
||||
beforeEach(() => {
|
||||
React = require('react');
|
||||
onlyChild = require('onlyChild');
|
||||
WrapComponent = class extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
{onlyChild(this.props.children, this.props.mapFn, this)}
|
||||
{React.Children.only(this.props.children, this.props.mapFn, this)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -38,7 +36,7 @@ describe('onlyChild', () => {
|
||||
<span />
|
||||
</WrapComponent>
|
||||
);
|
||||
onlyChild(instance.props.children);
|
||||
React.Children.only(instance.props.children);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
@@ -49,7 +47,7 @@ describe('onlyChild', () => {
|
||||
{null}
|
||||
</WrapComponent>
|
||||
);
|
||||
onlyChild(instance.props.children);
|
||||
React.Children.only(instance.props.children);
|
||||
}).toThrow();
|
||||
|
||||
expect(function() {
|
||||
@@ -58,7 +56,7 @@ describe('onlyChild', () => {
|
||||
{undefined}
|
||||
</WrapComponent>
|
||||
);
|
||||
onlyChild(instance.props.children);
|
||||
React.Children.only(instance.props.children);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
@@ -69,7 +67,7 @@ describe('onlyChild', () => {
|
||||
{[<span key="abc" />]}
|
||||
</WrapComponent>
|
||||
);
|
||||
onlyChild(instance.props.children);
|
||||
React.Children.only(instance.props.children);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
@@ -80,7 +78,7 @@ describe('onlyChild', () => {
|
||||
{<span />}
|
||||
</WrapComponent>
|
||||
);
|
||||
onlyChild(instance.props.children);
|
||||
React.Children.only(instance.props.children);
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
@@ -90,6 +88,6 @@ describe('onlyChild', () => {
|
||||
<span />
|
||||
</WrapComponent>
|
||||
);
|
||||
expect(onlyChild(instance.props.children)).toEqual(<span />);
|
||||
expect(React.Children.only(instance.props.children)).toEqual(<span />);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('ReactContextValidator', () => {
|
||||
PropTypes = require('prop-types');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
// TODO: This behavior creates a runtime dependency on propTypes. We should
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('create-react-class-integration', () => {
|
||||
PropTypes = require('prop-types');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
createReactClass = require('create-react-class/factory')(
|
||||
React.Component,
|
||||
React.isValidElement,
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('ReactElement', () => {
|
||||
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
// NOTE: We're explicitly not using JSX here. This is intended to test
|
||||
// classic JS without JSX.
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('ReactElementClone', () => {
|
||||
PropTypes = require('prop-types');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
// NOTE: We're explicitly not using JSX here. This is intended to test
|
||||
// classic JS without JSX.
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('ReactElementValidator', () => {
|
||||
PropTypes = require('prop-types');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
ComponentClass = class extends React.Component {
|
||||
render() {
|
||||
return React.createElement('div');
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('ReactJSXElement', () => {
|
||||
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
Component = class extends React.Component {
|
||||
render() {
|
||||
return <div />;
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('ReactJSXElementValidator', () => {
|
||||
PropTypes = require('prop-types');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
Component = class extends React.Component {
|
||||
render() {
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright 2016-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('ReactARTFiber');
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright 2016-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('ReactTestUtils');
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright 2016-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('ReactNative');
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright 2016-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('ReactNoop');
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright 2016-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('ReactShallowRenderer');
|
||||
@@ -20,7 +20,7 @@ describe('EventPluginHub', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should prevent non-function listeners, at dispatch', () => {
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('ReactChildReconciler', () => {
|
||||
jest.resetModules();
|
||||
|
||||
React = require('react');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
function createIterable(array) {
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('ReactComponent', () => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should throw on invalid render targets', () => {
|
||||
|
||||
@@ -91,7 +91,7 @@ describe('ReactComponentLifeCycle', () => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
PropTypes = require('prop-types');
|
||||
});
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@ describe('ReactCompositeComponent', () => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
ReactCurrentOwner = require('ReactCurrentOwner');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactCurrentOwner = require('react')
|
||||
.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
PropTypes = require('prop-types');
|
||||
shallowEqual = require('fbjs/lib/shallowEqual');
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('ReactCompositeComponentDOMMinimalism', () => {
|
||||
beforeEach(() => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
LowerLevelComposite = class extends React.Component {
|
||||
render() {
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('ReactCompositeComponentNestedState-state', () => {
|
||||
beforeEach(() => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should provide up to date values for props', () => {
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('ReactEmptyComponent', () => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
log = jasmine.createSpy();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('ReactIdentity', () => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should allow key property to express identity', () => {
|
||||
|
||||
@@ -21,8 +21,8 @@ var ReactDOMServer;
|
||||
describe('ReactMockedComponent', () => {
|
||||
beforeEach(() => {
|
||||
React = require('react');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactDOMServer = require('ReactDOMServer');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
|
||||
AutoMockedComponent = jest.genMockFromModule(
|
||||
'ReactMockedComponentTestComponent',
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
var ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
// Helpers
|
||||
var testAllPermutations = function(testCases) {
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
// TODO: can we express this test with only public API?
|
||||
var ReactDOMComponentTree = require('ReactDOMComponentTree');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
var ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
/**
|
||||
* Ensure that all callbacks are invoked, passing this unique argument.
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('ReactUpdates', () => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should batch state when updating state twice', () => {
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('refs-destruction', () => {
|
||||
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
TestComponent = class extends React.Component {
|
||||
render() {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
var React = require('react');
|
||||
var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
var ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
/**
|
||||
* Counts clicks and has a renders an item for each click. Each item rendered
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
var ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
var Group;
|
||||
var Shape;
|
||||
@@ -24,7 +24,7 @@ var TestComponent;
|
||||
|
||||
var Missing = {};
|
||||
|
||||
var ReactART = require('ReactARTFiber');
|
||||
var ReactART = require('react-art');
|
||||
var ARTSVGMode = require('art/modes/svg');
|
||||
var ARTCurrentMode = require('art/modes/current');
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
var ReactTestUtils = require('react-dom/test-utils');
|
||||
var PropTypes = require('prop-types');
|
||||
|
||||
describe('ReactDOMFiber', () => {
|
||||
|
||||
@@ -16,6 +16,7 @@ describe('CSSProperty', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
// TODO: can we express this test with only public API?
|
||||
CSSProperty = require('CSSProperty');
|
||||
});
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ describe('DOMPropertyOperations', () => {
|
||||
var ReactDOMInjection = require('ReactDOMInjection');
|
||||
ReactDOMInjection.inject();
|
||||
|
||||
// TODO: can we express this test with only public API?
|
||||
DOMPropertyOperations = require('DOMPropertyOperations');
|
||||
DOMProperty = require('DOMProperty');
|
||||
ReactDOMComponentTree = require('ReactDOMComponentTree');
|
||||
|
||||
@@ -60,13 +60,14 @@ describe('ReactBrowserEventEmitter', () => {
|
||||
jest.resetModules();
|
||||
LISTENER.mockClear();
|
||||
EventListener = require('fbjs/lib/EventListener');
|
||||
// TODO: can we express this test with only public API?
|
||||
EventPluginHub = require('EventPluginHub');
|
||||
EventPluginRegistry = require('EventPluginRegistry');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMComponentTree = require('ReactDOMComponentTree');
|
||||
ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
TapEventPlugin = require('TapEventPlugin');
|
||||
|
||||
var container = document.createElement('div');
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
var ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
describe('ReactDOM', () => {
|
||||
// TODO: uncomment this test once we can run in phantom, which
|
||||
|
||||
@@ -29,7 +29,8 @@ describe('ReactDOMComponent', () => {
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
// TODO: can we express this test with only public API?
|
||||
inputValueTracking = require('inputValueTracking');
|
||||
});
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ describe('ReactDOMComponentTree', () => {
|
||||
beforeEach(() => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
// TODO: can we express this test with only public API?
|
||||
ReactDOMComponentTree = require('ReactDOMComponentTree');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
});
|
||||
|
||||
@@ -25,9 +25,10 @@ describe('ReactDOMEventListener', () => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
// TODO: can we express this test with only public API?
|
||||
ReactDOMComponentTree = require('ReactDOMComponentTree');
|
||||
ReactDOMEventListener = require('ReactDOMEventListener');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
handleTopLevel = jest.fn();
|
||||
ReactDOMEventListener._handleTopLevel = handleTopLevel;
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('ReactDOMInvalidARIAHook', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
mountComponent = function(props) {
|
||||
ReactTestUtils.renderIntoDocument(<div {...props} />);
|
||||
|
||||
@@ -242,11 +242,12 @@ function expectMarkupMismatch(serverElement, clientElement) {
|
||||
function resetModules() {
|
||||
jest.resetModuleRegistry();
|
||||
PropTypes = require('prop-types');
|
||||
React = require('React');
|
||||
ReactDOM = require('ReactDOM');
|
||||
ReactDOMServer = require('ReactDOMServer');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
// TODO: can we express this test with only public API?
|
||||
ExecutionEnvironment = require('ExecutionEnvironment');
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('ReactEventIndependence', () => {
|
||||
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('does not crash with other react inside', () => {
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('ReactMount', () => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
try {
|
||||
if (WebComponents === undefined && typeof jest !== 'undefined') {
|
||||
|
||||
@@ -29,9 +29,9 @@ describe('ReactDOMServer', () => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
ReactMarkupChecksum = require('ReactMarkupChecksum');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactReconcileTransaction = require('ReactReconcileTransaction');
|
||||
PropTypes = require('prop-types');
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
describe('escapeTextContentForBrowser', () => {
|
||||
// TODO: can we express this test with only public API?
|
||||
var escapeTextContentForBrowser = require('escapeTextContentForBrowser');
|
||||
|
||||
it('should escape boolean to string', () => {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
var ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
describe('findDOMNode', () => {
|
||||
it('findDOMNode should return null if passed null', () => {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
var React = require('react');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
// TODO: can we express this test with only public API?
|
||||
var inputValueTracking = require('inputValueTracking');
|
||||
|
||||
describe('inputValueTracking', () => {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
describe('quoteAttributeValueForBrowser', () => {
|
||||
// TODO: can we express this test with only public API?
|
||||
var quoteAttributeValueForBrowser = require('quoteAttributeValueForBrowser');
|
||||
|
||||
it('should escape boolean to string', () => {
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
var React = require('react');
|
||||
var PropTypes = require('prop-types');
|
||||
var ReactDOM = require('react-dom');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
var renderSubtreeIntoContainer = require('renderSubtreeIntoContainer');
|
||||
var ReactTestUtils = require('react-dom/test-utils');
|
||||
var renderSubtreeIntoContainer = require('react-dom')
|
||||
.unstable_renderSubtreeIntoContainer;
|
||||
|
||||
describe('renderSubtreeIntoContainer', () => {
|
||||
it('should pass context when rendering subtree elsewhere', () => {
|
||||
|
||||
@@ -137,6 +137,7 @@ describe('ReactContextValidator', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
|
||||
// TODO: can we express this test with only public API?
|
||||
validateDOMNesting = require('validateDOMNesting');
|
||||
});
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ describe('BeforeInputEventPlugin', function() {
|
||||
// Modules which have dependency on BeforeInputEventPlugin are stored
|
||||
// in ModuleCache so that we can use these modules ouside test functions.
|
||||
this.ReactDOM = require('react-dom');
|
||||
|
||||
// TODO: can we express this test with only public API?
|
||||
this.ReactDOMComponentTree = require('ReactDOMComponentTree');
|
||||
this.SyntheticCompositionEvent = require('SyntheticCompositionEvent');
|
||||
this.SyntheticInputEvent = require('SyntheticInputEvent');
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
var ReactTestUtils = require('ReactTestUtils');
|
||||
var ReactTestUtils = require('react-dom/test-utils');
|
||||
// TODO: can we express this test with only public API?
|
||||
var ChangeEventPlugin = require('ChangeEventPlugin');
|
||||
var inputValueTracking = require('inputValueTracking');
|
||||
|
||||
|
||||
@@ -20,10 +20,11 @@ describe('EnterLeaveEventPlugin', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
|
||||
EnterLeaveEventPlugin = require('EnterLeaveEventPlugin');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
// TODO: can we express this test with only public API?
|
||||
ReactDOMComponentTree = require('ReactDOMComponentTree');
|
||||
EnterLeaveEventPlugin = require('EnterLeaveEventPlugin');
|
||||
});
|
||||
|
||||
it('should set relatedTarget properly in iframe', () => {
|
||||
|
||||
@@ -17,6 +17,7 @@ describe('FallbackCompositionState', () => {
|
||||
var TEXT = 'Hello world';
|
||||
|
||||
beforeEach(() => {
|
||||
// TODO: can we express this test with only public API?
|
||||
FallbackCompositionState = require('FallbackCompositionState');
|
||||
});
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@ describe('SelectEventPlugin', () => {
|
||||
beforeEach(() => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
// TODO: can we express this test with only public API?
|
||||
ReactDOMComponentTree = require('ReactDOMComponentTree');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
SelectEventPlugin = require('SelectEventPlugin');
|
||||
});
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('SimpleEventPlugin', function() {
|
||||
beforeEach(function() {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
onClick = jest.fn();
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ describe('SyntheticClipboardEvent', () => {
|
||||
var createEvent;
|
||||
|
||||
beforeEach(() => {
|
||||
// TODO: can we express this test with only public API?
|
||||
SyntheticClipboardEvent = require('SyntheticClipboardEvent');
|
||||
createEvent = function(nativeEvent) {
|
||||
var target = require('getEventTarget')(nativeEvent);
|
||||
|
||||
@@ -20,10 +20,11 @@ describe('SyntheticEvent', () => {
|
||||
var createEvent;
|
||||
|
||||
beforeEach(() => {
|
||||
// TODO: can we express this test with only public API?
|
||||
SyntheticEvent = require('SyntheticEvent');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
createEvent = function(nativeEvent) {
|
||||
var target = require('getEventTarget')(nativeEvent);
|
||||
|
||||
@@ -22,6 +22,7 @@ describe('SyntheticKeyboardEvent', () => {
|
||||
jest.mock('getEventCharCode');
|
||||
getEventCharCode = require('getEventCharCode');
|
||||
|
||||
// TODO: can we express this test with only public API?
|
||||
SyntheticKeyboardEvent = require('SyntheticKeyboardEvent');
|
||||
createEvent = function(nativeEvent) {
|
||||
var target = require('getEventTarget')(nativeEvent);
|
||||
|
||||
@@ -17,6 +17,7 @@ describe('SyntheticWheelEvent', () => {
|
||||
var createEvent;
|
||||
|
||||
beforeEach(() => {
|
||||
// TODO: can we express this test with only public API?
|
||||
SyntheticWheelEvent = require('SyntheticWheelEvent');
|
||||
|
||||
createEvent = function(nativeEvent) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
// TODO: can we express this test with only public API?
|
||||
var getEventCharCode = require('getEventCharCode');
|
||||
|
||||
describe('getEventCharCode', () => {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
// TODO: can we express this test with only public API?
|
||||
var getEventKey = require('getEventKey');
|
||||
|
||||
describe('getEventKey', () => {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
var getTestDocument = require('getTestDocument');
|
||||
|
||||
// TODO: can we express this test with only public API?
|
||||
var getNodeForCharacterOffset = require('getNodeForCharacterOffset');
|
||||
|
||||
// Create node from HTML string
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
// TODO: can we express this test with only public API?
|
||||
var setInnerHTML = require('setInnerHTML');
|
||||
var DOMNamespaces = require('DOMNamespaces');
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('ReactDOMIframe', () => {
|
||||
beforeEach(() => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should trigger load events', () => {
|
||||
|
||||
@@ -38,7 +38,8 @@ describe('ReactDOMInput', () => {
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
// TODO: can we express this test with only public API?
|
||||
inputValueTracking = require('inputValueTracking');
|
||||
spyOn(console, 'error');
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('ReactDOMOption', () => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should flatten children to a string', () => {
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('ReactDOMSelect', () => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should allow setting `defaultValue`', () => {
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('ReactDOMTextarea', () => {
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
|
||||
renderTextarea = function(component, container) {
|
||||
if (!container) {
|
||||
|
||||
@@ -20,12 +20,12 @@ let ReactTestUtils;
|
||||
|
||||
describe('ReactTestUtils', () => {
|
||||
beforeEach(() => {
|
||||
createRenderer = require('ReactShallowRenderer').createRenderer;
|
||||
createRenderer = require('react-test-renderer/shallow').createRenderer;
|
||||
PropTypes = require('prop-types');
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMServer = require('react-dom/server');
|
||||
ReactTestUtils = require('ReactTestUtils');
|
||||
ReactTestUtils = require('react-dom/test-utils');
|
||||
});
|
||||
|
||||
it('should call all of the lifecycle hooks', () => {
|
||||
|
||||
@@ -25,7 +25,7 @@ beforeEach(() => {
|
||||
PropTypes = require('prop-types');
|
||||
RCTEventEmitter = require('RCTEventEmitter');
|
||||
React = require('react');
|
||||
ReactNative = require('ReactNative');
|
||||
ReactNative = require('react-native');
|
||||
ResponderEventPlugin = require('ResponderEventPlugin');
|
||||
UIManager = require('UIManager');
|
||||
createReactNativeComponentClass = require('createReactNativeComponentClass');
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('ReactNative', () => {
|
||||
jest.resetModules();
|
||||
|
||||
React = require('react');
|
||||
ReactNative = require('ReactNative');
|
||||
ReactNative = require('react-native');
|
||||
UIManager = require('UIManager');
|
||||
createReactNativeComponentClass = require('createReactNativeComponentClass');
|
||||
});
|
||||
|
||||
@@ -21,8 +21,8 @@ describe('createReactNativeComponentClass', () => {
|
||||
jest.resetModules();
|
||||
|
||||
createReactNativeComponentClass = require('createReactNativeComponentClass');
|
||||
React = require('React');
|
||||
ReactNative = require('ReactNative');
|
||||
React = require('react');
|
||||
ReactNative = require('react-native');
|
||||
});
|
||||
|
||||
it('should register viewConfigs', () => {
|
||||
|
||||
@@ -20,7 +20,8 @@ describe('ReactCoroutine', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
// TODO: can we express this test with only public API?
|
||||
ReactCoroutine = require('ReactCoroutine');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactFeatureFlags.disableNewFiberFeatures = false;
|
||||
|
||||
@@ -17,7 +17,8 @@ var ReactFiberReconciler;
|
||||
describe('ReactFiberHostContext', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('React');
|
||||
React = require('react');
|
||||
// TODO: can we express this test with only public API?
|
||||
ReactFiberReconciler = require('ReactFiberReconciler');
|
||||
});
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('ReactIncremental', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
PropTypes = require('prop-types');
|
||||
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('ReactIncrementalErrorHandling', () => {
|
||||
jest.resetModules();
|
||||
PropTypes = require('prop-types');
|
||||
React = require('react');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactFeatureFlags.disableNewFiberFeatures = false;
|
||||
});
|
||||
|
||||
@@ -116,11 +116,12 @@ describe('ReactDebugFiberPerf', () => {
|
||||
global.performance = createUserTimingPolyfill();
|
||||
|
||||
// Import after the polyfill is set up:
|
||||
React = require('React');
|
||||
React = require('react');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
// TODO: can we express this test with only public API?
|
||||
ReactCoroutine = require('ReactCoroutine');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactPortal = require('ReactPortal');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactFeatureFlags.disableNewFiberFeatures = false;
|
||||
PropTypes = require('prop-types');
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('ReactIncrementalReflection', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactFeatureFlags.disableNewFiberFeatures = false;
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('ReactIncrementalScheduling', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactFeatureFlags.disableNewFiberFeatures = false;
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('ReactIncrementalSideEffects', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactFeatureFlags.disableNewFiberFeatures = false;
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('ReactIncrementalUpdates', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModuleRegistry();
|
||||
React = require('react');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactFeatureFlags.disableNewFiberFeatures = false;
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('ReactTopLevelFragment', function() {
|
||||
beforeEach(function() {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactFeatureFlags.disableNewFiberFeatures = false;
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('ReactTopLevelText', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
React = require('react');
|
||||
ReactNoop = require('ReactNoop');
|
||||
ReactNoop = require('react-noop-renderer');
|
||||
ReactFeatureFlags = require('ReactFeatureFlags');
|
||||
ReactFeatureFlags.disableNewFiberFeatures = false;
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ describe('EventPluginRegistry', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetModuleRegistry();
|
||||
// TODO: can we express this test with only public API?
|
||||
EventPluginRegistry = require('EventPluginRegistry');
|
||||
|
||||
createPlugin = function(properties) {
|
||||
|
||||
@@ -383,6 +383,7 @@ describe('ResponderEventPlugin', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
|
||||
// TODO: can we express this test with only public API?
|
||||
EventPluginHub = require('EventPluginHub');
|
||||
EventPluginUtils = require('EventPluginUtils');
|
||||
ResponderEventPlugin = require('ResponderEventPlugin');
|
||||
|
||||
@@ -15,6 +15,7 @@ var ReactErrorUtils;
|
||||
|
||||
describe('ReactErrorUtils', () => {
|
||||
beforeEach(() => {
|
||||
// TODO: can we express this test with only public API?
|
||||
ReactErrorUtils = require('ReactErrorUtils');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user