@@ -441,6 +441,79 @@ describe('fields', () => {
441441        } , 
442442      ] ) 
443443    } ) 
444+ 
445+     it ( 'supports x-jsf-presentation properties inside options' ,  ( )  =>  { 
446+       const  schema : JsfSchema  =  { 
447+         type : 'object' , 
448+         properties : { 
449+           plan : { 
450+             'type' : 'string' , 
451+             'oneOf' : [ 
452+               {  const : 'free' ,  title : 'Free'  } , 
453+               {  'const' : 'basic' ,  'title' : 'Basic' ,  'x-jsf-presentation' : {  meta : {  displayCost : '$30.00/mo' ,  originalCost : '$35.00/mo'  }  }  } , 
454+               {  'const' : 'standard' ,  'title' : 'Standard' ,  'x-jsf-presentation' : {  meta : {  displayCost : '$50.00/mo'  } ,  recommended : true  }  } , 
455+             ] , 
456+             'x-jsf-presentation' : { 
457+               inputType : 'radio' , 
458+             } , 
459+           } , 
460+         } , 
461+       } 
462+ 
463+       const  fields  =  buildFieldSchema ( schema ,  'root' ,  true ) ! . fields ! 
464+ 
465+       expect ( fields ) . toEqual ( [ 
466+         { 
467+           inputType : 'radio' , 
468+           type : 'radio' , 
469+           jsonType : 'string' , 
470+           isVisible : true , 
471+           name : 'plan' , 
472+           required : false , 
473+           options : [ 
474+             {  label : 'Free' ,  value : 'free'  } , 
475+             {  label : 'Basic' ,  value : 'basic' ,  meta : {  displayCost : '$30.00/mo' ,  originalCost : '$35.00/mo'  }  } , 
476+             {  label : 'Standard' ,  value : 'standard' ,  meta : {  displayCost : '$50.00/mo'  } ,  recommended : true  } , 
477+           ] , 
478+         } , 
479+       ] ) 
480+     } ) 
481+ 
482+     it ( 'ignores a non-object x-jsf-presentation' ,  ( )  =>  { 
483+       const  schema : JsfSchema  =  { 
484+         type : 'object' , 
485+         properties : { 
486+           plan : { 
487+             'type' : 'string' , 
488+             'oneOf' : [ 
489+               {  const : 'free' ,  title : 'Free'  } , 
490+               // @ts -expect-error - using an invalid value on purpose 
491+               {  'const' : 'basic' ,  'title' : 'Basic' ,  'x-jsf-presentation' : '$30.00/mo'  } , 
492+             ] , 
493+             'x-jsf-presentation' : { 
494+               inputType : 'radio' , 
495+             } , 
496+           } , 
497+         } , 
498+       } 
499+ 
500+       const  fields  =  buildFieldSchema ( schema ,  'root' ,  true ) ! . fields ! 
501+ 
502+       expect ( fields ) . toEqual ( [ 
503+         { 
504+           inputType : 'radio' , 
505+           type : 'radio' , 
506+           jsonType : 'string' , 
507+           isVisible : true , 
508+           name : 'plan' , 
509+           required : false , 
510+           options : [ 
511+             {  label : 'Free' ,  value : 'free'  } , 
512+             {  label : 'Basic' ,  value : 'basic'  } , 
513+           ] , 
514+         } , 
515+       ] ) 
516+     } ) 
444517  } ) 
445518
446519  describe ( 'input type calculation' ,  ( )  =>  { 
0 commit comments