@@ -469,6 +469,53 @@ describe('React', () => {
469
469
expect ( invocationCount ) . toEqual ( 2 )
470
470
} )
471
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
+
472
519
it ( 'should invoke mapState every time props are changed if it has a second argument' , ( ) => {
473
520
const store = createStore ( stringBuilder )
474
521
@@ -570,6 +617,54 @@ describe('React', () => {
570
617
expect ( invocationCount ) . toEqual ( 1 )
571
618
} )
572
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
+
573
668
it ( 'should invoke mapDispatch every time props are changed if it has a second argument' , ( ) => {
574
669
const store = createStore ( stringBuilder )
575
670
0 commit comments