@@ -9,8 +9,6 @@ import SideBarDecorator from './utils/SideBarDecorator'
99const context :Partial < T . MachineContext > = {
1010env :{ machineId :'' , sessionId :'' , token :'' } ,
1111error :null ,
12- position :{ levelId :'2' , stepId :'2.2' } ,
13- progress :{ levels :{ '1' :true } , steps :{ '1.1' :true , '1.2' :true , '1.3' :true , '2.1' :true } , complete :false } ,
1412processes :[ ] ,
1513testStatus :null ,
1614tutorial :{
@@ -142,12 +140,35 @@ const context: Partial<T.MachineContext> = {
142140storiesOf ( 'Tutorial' , module )
143141. addDecorator ( SideBarDecorator )
144142. addDecorator ( withKnobs )
145- . add ( '1 step ' , ( ) => {
143+ . add ( '1.1 Start ' , ( ) => {
146144const firstLevel = {
147145 ...context ,
148146position :{ levelId :'1' , stepId :'1.2' } ,
149147progress :{ levels :{ } , steps :{ } , complete :false } ,
150148}
151149return < Tutorial state = "Normal" context = { firstLevel } send = { action ( 'send' ) } />
152150} )
153- . add ( '3 step' , ( ) => < Tutorial state = "Normal" context = { context } send = { action ( 'send' ) } /> )
151+ . add ( '1.3 Level Complete' , ( ) => {
152+ const levelComplete = {
153+ ...context ,
154+ position :{ levelId :'1' , stepId :'1.2' } ,
155+ progress :{ levels :{ } , steps :{ '1.1' :true } , complete :false } ,
156+ }
157+ return < Tutorial state = "LevelComplete" context = { levelComplete } send = { action ( 'send' ) } />
158+ } )
159+ . add ( '3.1 Level Start' , ( ) => {
160+ const newLevel = {
161+ ...context ,
162+ position :{ levelId :'1' , stepId :'1.2' } ,
163+ progress :{ levels :{ '1' :true , '2' :true } , steps :{ } , complete :false } ,
164+ }
165+ return < Tutorial state = "Normal" context = { newLevel } send = { action ( 'send' ) } />
166+ } )
167+ . add ( '3.3 Final' , ( ) => {
168+ const lastLevel = {
169+ ...context ,
170+ position :{ levelId :'3' , stepId :'3.3' } ,
171+ progress :{ levels :{ '3' :true } , steps :{ '3.3' :true } , complete :true } ,
172+ }
173+ return < Tutorial state = "LevelComplete" context = { lastLevel } send = { action ( 'send' ) } />
174+ } )