From 235f8b03a9dea476f75e6350088b4e258ae4335f Mon Sep 17 00:00:00 2001 From: Donnie West Date: Tue, 13 Dec 2016 16:47:57 -0600 Subject: [PATCH] Pass props down to child components --- src/Reducer.js | 8 ++++++++ test/Reducer.test.js | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Reducer.js b/src/Reducer.js index 8d16bf490..7a27603ab 100644 --- a/src/Reducer.js +++ b/src/Reducer.js @@ -226,6 +226,14 @@ function inject(state, action, props, scenes) { if (action.unmountScenes) { resetHistoryStack(state.children[ind]); } + + state.children[ind] = getInitialState( + props, + scenes, + state.index, + action, + ); + return { ...state, index: ind }; } case ActionConst.REPLACE: diff --git a/test/Reducer.test.js b/test/Reducer.test.js index dc9a89090..9566e3a36 100644 --- a/test/Reducer.test.js +++ b/test/Reducer.test.js @@ -145,11 +145,11 @@ describe('handling actions', () => { expect(current.key).to.eq('0_hello_'); }); - it('switches to a corret tab on JUMP', () => { + it('switches to a correct tab on JUMP', () => { Actions.main(); Actions.hello(); - expect(current.key).to.eq('0_hello_'); + expect(current.key).to.eq('hello_0_hello_'); }); }); @@ -183,7 +183,7 @@ describe('passing props from actions', () => { expect(current.customProp).to.eq(undefined); }); - it.skip('passes props for tab scenes', () => { + it('passes props for tab scenes', () => { const scene = ( @@ -214,7 +214,7 @@ describe('passing props from actions', () => { expect(current.anotherProp).to.eq(undefined); }); - it.skip('passes props for nested tab scenes', () => { + it('passes props for nested tab scenes', () => { const scene = ( @@ -250,7 +250,7 @@ describe('passing props from actions', () => { expect(current.anotherProp).to.eq(undefined); }); - it.skip('passes props for very nested tab scenes', () => { + it('passes props for very nested tab scenes', () => { const scene = (