[#9627] Fix componentWillUnmount test case in isMounted tests (#9629)
* Fix componentWillUnmount test case in isMounted tests and add mixin tests * Upgrade create-react-class to 15.6.0
Michael Ridgway committed
Jun 20, 2017 at 15:37 UTC
7b05946776d2c66ade493f757a99d638c555c4b2
3 files changed
+32
-7
package.json
+1
-1
@@ -43,7 +43,7 @@
43
"coffee-script": "^1.8.0",
44
"core-js": "^2.2.1",
45
"coveralls": "^2.11.6",
46
- "create-react-class": "^15.5.2",
46
+ "create-react-class": "^15.6.0",
47
"del": "^2.0.2",
48
"derequire": "^2.0.3",
49
"escape-string-regexp": "^1.0.5",
src/isomorphic/classic/__tests__/createReactClassIntegration-test.js
+25
-1
@@ -371,6 +371,25 @@ describe('create-react-class-integration', () => {
371
var instance;
372
var Component = createReactClass({
373
displayName: 'MyComponent',
374
+ mixins: [
375
+ {
376
+ componentWillMount() {
377
+ this.log('mixin.componentWillMount');
378
+ },
379
+ componentDidMount() {
380
+ this.log('mixin.componentDidMount');
381
+ },
382
+ componentWillUpdate() {
383
+ this.log('mixin.componentWillUpdate');
384
+ },
385
+ componentDidUpdate() {
386
+ this.log('mixin.componentDidUpdate');
387
+ },
388
+ componentWillUnmount() {
389
+ this.log('mixin.componentWillUnmount');
390
+ },
391
+ },
392
+ ],
393
log(name) {
394
ops.push(`${name}: ${this.isMounted()}`);
395
},
@@ -407,13 +426,18 @@ describe('create-react-class-integration', () => {
426
instance.log('after unmount');
427
expect(ops).toEqual([
428
'getInitialState: false',
429
+ 'mixin.componentWillMount: false',
430
'componentWillMount: false',
431
'render: false',
432
+ 'mixin.componentDidMount: true',
433
'componentDidMount: true',
434
+ 'mixin.componentWillUpdate: true',
435
'componentWillUpdate: true',
436
'render: true',
437
+ 'mixin.componentDidUpdate: true',
438
'componentDidUpdate: true',
416
- 'componentWillUnmount: false',
439
+ 'mixin.componentWillUnmount: true',
440
+ 'componentWillUnmount: true',
441
'after unmount: false',
442
]);
443
yarn.lock
+6
-5
@@ -1529,11 +1529,12 @@ create-hmac@^1.1.0, create-hmac@^1.1.2:
1529
create-hash "^1.1.0"
1530
inherits "^2.0.1"
1531
1532
-create-react-class@^15.5.2:
1533
- version "15.5.2"
1534
- resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.5.2.tgz#6a8758348df660b88326a0e764d569f274aad681"
1532
+create-react-class@^15.6.0:
1533
+ version "15.6.0"
1534
+ resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.0.tgz#ab448497c26566e1e29413e883207d57cfe7bed4"
1535
dependencies:
1536
fbjs "^0.8.9"
1537
+ loose-envify "^1.3.1"
1538
object-assign "^4.1.1"
1539
1540
cross-spawn-async@^2.1.1, cross-spawn-async@^2.2.2:
@@ -3245,7 +3246,7 @@ jest-matcher-utils@^19.0.0:
3246
chalk "^1.1.3"
3247
pretty-format "^19.0.0"
3248
3248
-jest-matchers@^19.0.0, jest-matchers@^19.0.1:
3249
+jest-matchers@^19.0.0:
3250
version "19.0.0"
3251
resolved "https://registry.yarnpkg.com/jest-matchers/-/jest-matchers-19.0.0.tgz#c74ecc6ebfec06f384767ba4d6fa4a42d6755754"
3252
dependencies:
@@ -3687,7 +3688,7 @@ longest@^1.0.1:
3688
version "1.0.1"
3689
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
3690
3690
-loose-envify@^1.0.0, loose-envify@^1.1.0:
3691
+loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
3692
version "1.3.1"
3693
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
3694
dependencies: