@@ -205,6 +205,63 @@ describe('<Wizard />', () => {
205205 expect ( enterHandle . default ) . toHaveBeenCalledWith ( event , formOptions , '1' , findCurrentStep , handleNext , handleSubmit ) ;
206206 } ) ;
207207
208+ it ( 'should render correctly with objects as substepOf and nodes titles' , ( ) => {
209+ schema = {
210+ fields : [
211+ {
212+ name : 'wizard' ,
213+ component : 'wizard' ,
214+ inModal : true ,
215+ fields : [
216+ {
217+ title : < h1 > Custom title</ h1 > ,
218+ name : 'first-step' ,
219+ fields : [ ] ,
220+ nextStep : 'middle-step' ,
221+ substepOf : { name : 'summary' , title : < h2 > Custom title 2</ h2 > }
222+ } ,
223+ {
224+ name : 'middle-step' ,
225+ title : 'middle-step' ,
226+ fields : [ ] ,
227+ substepOf : 'summary' ,
228+ nextStep : 'end'
229+ } ,
230+ {
231+ name : 'end' ,
232+ title : < h3 > Custom title 3</ h3 > ,
233+ fields : [ ]
234+ }
235+ ]
236+ }
237+ ]
238+ } ;
239+
240+ const wrapper = mount ( < FormRenderer { ...initialProps } schema = { schema } /> ) ;
241+
242+ expect (
243+ wrapper
244+ . find ( WizardNavItem )
245+ . first ( )
246+ . props ( ) . content
247+ ) . toEqual ( < h2 > Custom title 2</ h2 > ) ;
248+
249+ expect (
250+ wrapper
251+ . find ( WizardNavItem )
252+ . first ( )
253+ . children ( )
254+ . find ( WizardNavItem )
255+ ) . toHaveLength ( 2 ) ;
256+
257+ expect (
258+ wrapper
259+ . find ( WizardNavItem )
260+ . last ( )
261+ . props ( ) . content
262+ ) . toEqual ( < h3 > Custom title 3</ h3 > ) ;
263+ } ) ;
264+
208265 it ( 'should render correctly in modal and unmount' , ( ) => {
209266 schema = {
210267 fields : [
@@ -315,8 +372,8 @@ describe('<Wizard />', () => {
315372 loading : false ,
316373 maxStepIndex : 1 ,
317374 navSchema : [
318- { index : 0 , primary : true , substepOf : undefined , title : 'foo-step' } ,
319- { index : 1 , primary : true , substepOf : undefined , title : 'bar-step' }
375+ { index : 0 , name : '1' , primary : true , substepOf : undefined , substepOfTitle : undefined , title : 'foo-step' } ,
376+ { index : 1 , name : '2' , primary : true , substepOf : undefined , substepOfTitle : undefined , title : 'bar-step' }
320377 ] ,
321378 prevSteps : [ '1' ] ,
322379 registeredFieldsHistory : { 1 : [ 'foo-field' ] }
0 commit comments