@@ -426,10 +426,12 @@ describe('React', () => {
426
426
427
427
let invocationCount = 0
428
428
429
- @connect ( ( ) => {
429
+ /*eslint-disable no-unused-vars */
430
+ @connect ( ( arg1 ) => {
430
431
invocationCount ++
431
432
return { }
432
433
} )
434
+ /*eslint-enable no-unused-vars */
433
435
class WithoutProps extends Component {
434
436
render ( ) {
435
437
return < Passthrough { ...this . props } />
@@ -467,6 +469,53 @@ describe('React', () => {
467
469
expect ( invocationCount ) . toEqual ( 2 )
468
470
} )
469
471
472
+ it ( 'should invoke mapState every time props are changed if it has zero arguments' , ( ) => {
473
+ const store = createStore ( stringBuilder )
474
+
475
+ let invocationCount = 0
476
+
477
+ @connect ( ( ) => {
478
+ invocationCount ++
479
+ return { }
480
+ } )
481
+
482
+ class WithoutProps extends Component {
483
+ render ( ) {
484
+ return < Passthrough { ...this . props } />
485
+ }
486
+ }
487
+
488
+ class OuterComponent extends Component {
489
+ constructor ( ) {
490
+ super ( )
491
+ this . state = { foo : 'FOO' }
492
+ }
493
+
494
+ setFoo ( foo ) {
495
+ this . setState ( { foo } )
496
+ }
497
+
498
+ render ( ) {
499
+ return (
500
+ < div >
501
+ < WithoutProps { ...this . state } />
502
+ </ div >
503
+ )
504
+ }
505
+ }
506
+
507
+ let outerComponent
508
+ TestUtils . renderIntoDocument (
509
+ < ProviderMock store = { store } >
510
+ < OuterComponent ref = { c => outerComponent = c } />
511
+ </ ProviderMock >
512
+ )
513
+ outerComponent . setFoo ( 'BAR' )
514
+ outerComponent . setFoo ( 'DID' )
515
+
516
+ expect ( invocationCount ) . toEqual ( 4 )
517
+ } )
518
+
470
519
it ( 'should invoke mapState every time props are changed if it has a second argument' , ( ) => {
471
520
const store = createStore ( stringBuilder )
472
521
@@ -524,10 +573,12 @@ describe('React', () => {
524
573
525
574
let invocationCount = 0
526
575
527
- @connect ( null , ( ) => {
576
+ /*eslint-disable no-unused-vars */
577
+ @connect ( null , ( arg1 ) => {
528
578
invocationCount ++
529
579
return { }
530
580
} )
581
+ /*eslint-enable no-unused-vars */
531
582
class WithoutProps extends Component {
532
583
render ( ) {
533
584
return < Passthrough { ...this . props } />
@@ -566,6 +617,54 @@ describe('React', () => {
566
617
expect ( invocationCount ) . toEqual ( 1 )
567
618
} )
568
619
620
+ it ( 'should invoke mapDispatch every time props are changed if it has zero arguments' , ( ) => {
621
+ const store = createStore ( stringBuilder )
622
+
623
+ let invocationCount = 0
624
+
625
+ @connect ( null , ( ) => {
626
+ invocationCount ++
627
+ return { }
628
+ } )
629
+
630
+ class WithoutProps extends Component {
631
+ render ( ) {
632
+ return < Passthrough { ...this . props } />
633
+ }
634
+ }
635
+
636
+ class OuterComponent extends Component {
637
+ constructor ( ) {
638
+ super ( )
639
+ this . state = { foo : 'FOO' }
640
+ }
641
+
642
+ setFoo ( foo ) {
643
+ this . setState ( { foo } )
644
+ }
645
+
646
+ render ( ) {
647
+ return (
648
+ < div >
649
+ < WithoutProps { ...this . state } />
650
+ </ div >
651
+ )
652
+ }
653
+ }
654
+
655
+ let outerComponent
656
+ TestUtils . renderIntoDocument (
657
+ < ProviderMock store = { store } >
658
+ < OuterComponent ref = { c => outerComponent = c } />
659
+ </ ProviderMock >
660
+ )
661
+
662
+ outerComponent . setFoo ( 'BAR' )
663
+ outerComponent . setFoo ( 'DID' )
664
+
665
+ expect ( invocationCount ) . toEqual ( 3 )
666
+ } )
667
+
569
668
it ( 'should invoke mapDispatch every time props are changed if it has a second argument' , ( ) => {
570
669
const store = createStore ( stringBuilder )
571
670
0 commit comments