@@ -9,9 +9,10 @@ const Step1 = () => <></>;
99const Step2 = ( ) => < > </ > ;
1010const Step3 = ( ) => < > </ > ;
1111const Step4 = ( ) => < > </ > ;
12+ const Navigation = ( ) => < > </ > ;
1213
1314const testRenderer = TestRenderer . create (
14- < Steps >
15+ < Steps config = { { navigation : { component : Navigation , location : "before" } } } >
1516 < Step component = { Step1 } title = "My first step" beforeStepChange = { mockFn } />
1617 < Step component = { Step2 } />
1718 < Step component = { Step3 } />
@@ -176,3 +177,26 @@ describe("state updates correctly", () => {
176177 expect ( newProps1 . getState ( "lastname" , "" ) ) . toBe ( "Mutevelli" ) ;
177178 } ) ;
178179} ) ;
180+
181+ describe ( "global navigation" , ( ) => {
182+ it ( "takes parameters correctly" , ( ) => {
183+ const navProps = testInstance . findByType ( Navigation ) . props ;
184+ expect ( navProps . size ) . toBe ( 4 ) ;
185+ expect ( navProps . current ) . toBe ( 1 ) ;
186+ expect ( navProps . progress ) . toBe ( 0 ) ;
187+ } ) ;
188+
189+ it ( "buttons work correctly" , ( ) => {
190+ const navProps = testInstance . findByType ( Navigation ) . props ;
191+
192+ act ( ( ) => navProps . next ( ) ) ;
193+
194+ const newNavProps = testInstance . findByType ( Navigation ) . props ;
195+
196+ expect ( newNavProps . current ) . toBe ( 2 ) ;
197+ expect ( newNavProps . size ) . toBe ( 4 ) ;
198+ expect ( newNavProps . progress ) . toBe (
199+ ( newNavProps . current - 1 ) / ( newNavProps . size - 1 ) ,
200+ ) ;
201+ } ) ;
202+ } ) ;
0 commit comments