File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export const createCombinatorRenderInfos = (
6262 ) ,
6363 label :
6464 subSchema . title ??
65- resolvedSubSchema . title ??
65+ resolvedSubSchema ? .title ??
6666 `${ keyword } -${ subSchemaIndex } ` ,
6767 } ;
6868 } ) ;
Original file line number Diff line number Diff line change @@ -80,3 +80,34 @@ test('createCombinatorRenderInfos - uses overrides for labels when subschemas ar
8080 t . deepEqual ( duaRenderInfo . label , 'DuaOverride' ) ;
8181 t . deepEqual ( lipaRenderInfo . label , 'LipaOverride' ) ;
8282} ) ;
83+
84+ const schemaWithoutRefs = {
85+ type : 'object' ,
86+ properties : {
87+ widget : {
88+ anyOf : [
89+ {
90+ type : 'object' ,
91+ properties : { name : { type : 'string' } } ,
92+ } ,
93+ {
94+ type : 'object' ,
95+ properties : { name : { type : 'string' } } ,
96+ } ,
97+ ] ,
98+ } ,
99+ } ,
100+ } ;
101+
102+ test ( 'createCombinatorRenderInfos - uses keyword + index when no labels provided' , ( t ) => {
103+ const [ duaRenderInfo , lipaRenderInfo ] = createCombinatorRenderInfos (
104+ schemaWithoutRefs . properties . widget . anyOf ,
105+ schemaWithoutRefs ,
106+ 'anyOf' ,
107+ control ,
108+ 'widget' ,
109+ [ ]
110+ ) ;
111+ t . deepEqual ( duaRenderInfo . label , 'anyOf-0' ) ;
112+ t . deepEqual ( lipaRenderInfo . label , 'anyOf-1' ) ;
113+ } ) ;
You can’t perform that action at this time.
0 commit comments