File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1564,6 +1564,36 @@ describe('React', () => {
1564
1564
expect ( actualState ) . toEqual ( expectedState )
1565
1565
} )
1566
1566
1567
+ it ( 'should ignore non-react-context values that are passed as a prop to the component' , ( ) => {
1568
+ class Container extends Component {
1569
+ render ( ) {
1570
+ return < Passthrough />
1571
+ }
1572
+ }
1573
+
1574
+ const nonContext = { someProperty : { } }
1575
+
1576
+ let actualState
1577
+
1578
+ const expectedState = { foos : { } }
1579
+
1580
+ const decorator = connect ( state => {
1581
+ actualState = state
1582
+ return { }
1583
+ } )
1584
+ const Decorated = decorator ( Container )
1585
+
1586
+ const store = createStore ( ( ) => expectedState )
1587
+
1588
+ rtl . render (
1589
+ < ProviderMock store = { store } >
1590
+ < Decorated context = { nonContext } />
1591
+ </ ProviderMock >
1592
+ )
1593
+
1594
+ expect ( actualState ) . toEqual ( expectedState )
1595
+ } )
1596
+
1567
1597
it ( 'should throw an error if the store is not in the props or context' , ( ) => {
1568
1598
const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1569
1599
You can’t perform that action at this time.
0 commit comments