Add react-lifecycles-compat and update tests (#12127)
* Installed react-lifecycles-compat module * Updated react-lifecycles-compat integration tests to use real polyfill
Brian Vaughn committed
Jan 31, 2018 at 10:33 UTC
e202f984ea0ead55c40a8864492a0646ada8e189
5 files changed
+8
-21
package.json
+1
@@ -81,6 +81,7 @@
81
"prettier": "1.8.1",
82
"prop-types": "^15.6.0",
83
"random-seed": "^0.3.0",
84
+ "react-lifecycles-compat": "^1.0.2",
85
"rimraf": "^2.6.1",
86
"rollup": "^0.52.1",
87
"rollup-plugin-babel": "^3.0.1",
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.internal.js
+1
-7
@@ -61,13 +61,7 @@ describe('ReactComponentLifeCycle', () => {
61
});
62
63
describe('react-lifecycles-compat', () => {
64
- // TODO Replace this with react-lifecycles-compat once it's been published
65
- function polyfill(Component) {
66
- Component.prototype.componentWillMount = function() {};
67
- Component.prototype.componentWillMount.__suppressDeprecationWarning = true;
68
- Component.prototype.componentWillReceiveProps = function() {};
69
- Component.prototype.componentWillReceiveProps.__suppressDeprecationWarning = true;
70
- }
64
+ const polyfill = require('react-lifecycles-compat');
65
66
it('should not warn about deprecated cWM/cWRP for polyfilled components', () => {
67
class PolyfilledComponent extends React.Component {
packages/react-dom/src/__tests__/ReactDOMServerLifecycles-test.internal.js
+1
-7
@@ -65,13 +65,7 @@ describe('ReactDOMServerLifecycles', () => {
65
});
66
67
describe('react-lifecycles-compat', () => {
68
- // TODO Replace this with react-lifecycles-compat once it's been published
69
- function polyfill(Component) {
70
- Component.prototype.componentWillMount = function() {};
71
- Component.prototype.componentWillMount.__suppressDeprecationWarning = true;
72
- Component.prototype.componentWillReceiveProps = function() {};
73
- Component.prototype.componentWillReceiveProps.__suppressDeprecationWarning = true;
74
- }
68
+ const polyfill = require('react-lifecycles-compat');
69
70
it('should not warn about deprecated cWM/cWRP for polyfilled components', () => {
71
class PolyfilledComponent extends React.Component {
packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.internal.js
+1
-7
@@ -56,13 +56,7 @@ describe('ReactShallowRenderer', () => {
56
});
57
58
describe('react-lifecycles-compat', () => {
59
- // TODO Replace this with react-lifecycles-compat once it's been published
60
- function polyfill(Component) {
61
- Component.prototype.componentWillMount = function() {};
62
- Component.prototype.componentWillMount.__suppressDeprecationWarning = true;
63
- Component.prototype.componentWillReceiveProps = function() {};
64
- Component.prototype.componentWillReceiveProps.__suppressDeprecationWarning = true;
65
- }
59
+ const polyfill = require('react-lifecycles-compat');
60
61
it('should not warn about deprecated cWM/cWRP for polyfilled components', () => {
62
class PolyfilledComponent extends React.Component {
yarn.lock
+4
@@ -4412,6 +4412,10 @@ react-dom@15.5.4:
4412
object-assign "^4.1.0"
4413
prop-types "~15.5.7"
4414
4415
+react-lifecycles-compat@^1.0.2:
4416
+ version "1.0.2"
4417
+ resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-1.0.2.tgz#551d8b1d156346e5fcf30ffac9b32ce3f78b8850"
4418
+
4419
react@15.5.4:
4420
version "15.5.4"
4421
resolved "https://registry.yarnpkg.com/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047"