@@ -54,6 +54,7 @@ import {
5454 JsonSchema ,
5555 LabelElement ,
5656 UISchemaElement ,
57+ hasOption ,
5758} from '../src' ;
5859
5960const test = anyTest as TestInterface < { uischema : ControlElement } > ;
@@ -183,6 +184,30 @@ test('optionIs should return false for UI schema elements without options cell',
183184 t . false ( optionIs ( 'answer' , 42 ) ( control , undefined , undefined ) ) ;
184185} ) ;
185186
187+ test ( 'hasOption should check for options' , ( t ) => {
188+ const control : ControlElement = {
189+ type : 'Control' ,
190+ scope : '#/properties/bar' ,
191+ options : {
192+ answer : 42 ,
193+ } ,
194+ } ;
195+ t . true ( hasOption ( 'answer' ) ( control , undefined , undefined ) ) ;
196+ } ) ;
197+
198+ test ( 'hasOption should not fail if uischema is undefined or null' , ( t ) => {
199+ const uischema : UISchemaElement = null ;
200+ t . false ( hasOption ( 'answer' ) ( uischema , undefined , undefined ) ) ;
201+ } ) ;
202+
203+ test ( 'hasOption should return false for UI schema elements without options cell' , ( t ) => {
204+ const control : ControlElement = {
205+ type : 'Control' ,
206+ scope : '#/properties/bar' ,
207+ } ;
208+ t . false ( hasOption ( 'answer' ) ( control , undefined , undefined ) ) ;
209+ } ) ;
210+
186211test ( 'schemaMatches should check type sub-schema of control via predicate' , ( t ) => {
187212 const schema : JsonSchema = {
188213 type : 'object' ,
0 commit comments