@@ -297,6 +297,104 @@ describe('FormBuilder', () => {
297
297
expect ( errors ) . toEqual ( [ ] ) ;
298
298
} ) ;
299
299
300
+ it ( 'supports column size on sections' , ( ) => {
301
+ const jsonSchema = {
302
+ definitions : {
303
+ first_names : {
304
+ title : 'First Names' ,
305
+ type : 'string' ,
306
+ } ,
307
+ last_names : {
308
+ title : 'Last Names' ,
309
+ type : 'string' ,
310
+ } ,
311
+ residential_address : {
312
+ title : 'Residential Address' ,
313
+ type : 'object' ,
314
+ properties : {
315
+ country : {
316
+ title : 'Country' ,
317
+ type : 'string' ,
318
+ } ,
319
+ street_address_line : {
320
+ title : 'Street Address Line' ,
321
+ type : 'string' ,
322
+ } ,
323
+ } ,
324
+ dependencies : { } ,
325
+ required : [ ] ,
326
+ } ,
327
+ } ,
328
+ properties : {
329
+ user_first_names : {
330
+ $ref : '#/definitions/first_names' ,
331
+ title : 'User First Names' ,
332
+ description : '' ,
333
+ } ,
334
+ user_last_name : {
335
+ $ref : '#/definitions/last_names' ,
336
+ title : 'User Last Name' ,
337
+ description : '' ,
338
+ } ,
339
+ user_residential_address : {
340
+ $ref : '#/definitions/residential_address' ,
341
+ title : 'User Residential Address' ,
342
+ description : '' ,
343
+ } ,
344
+ } ,
345
+ dependencies : { } ,
346
+ required : [ ] ,
347
+ type : 'object' ,
348
+ } ;
349
+
350
+ const uischema = {
351
+ definitions : {
352
+ residential_address : {
353
+ 'ui:order' : [ 'country' , 'street_address_line' ] ,
354
+ } ,
355
+ } ,
356
+ 'ui:order' : [
357
+ 'user_first_names' ,
358
+ 'user_last_name' ,
359
+ 'user_residential_address' ,
360
+ ] ,
361
+ user_first_names : {
362
+ 'ui:column' : '25' ,
363
+ } ,
364
+ user_last_name : {
365
+ 'ui:column' : '25' ,
366
+ } ,
367
+ user_residential_address : {
368
+ 'ui:order' : [ 'country' , 'address_line' ] ,
369
+ 'ui:column' : '50' ,
370
+ country : {
371
+ 'ui:column' : '30' ,
372
+ } ,
373
+ street_address_line : {
374
+ 'ui:column' : '70' ,
375
+ } ,
376
+ } ,
377
+ } ;
378
+
379
+ const props = {
380
+ schema : JSON . stringify ( jsonSchema ) ,
381
+ uiSchema : JSON . stringify ( uischema ) ,
382
+ onChange : jest . fn ( ( ) => { } ) ,
383
+ mods : { } ,
384
+ className : 'my-form-builder' ,
385
+ } ;
386
+
387
+ const div = document . createElement ( 'div' ) ;
388
+ document . body . appendChild ( div ) ;
389
+ const wrapper = mount ( < FormBuilder { ...props } /> , { attachTo : div } ) ;
390
+ const errors = wrapper
391
+ . find ( '.alert-warning' )
392
+ . first ( )
393
+ . find ( 'li' )
394
+ . map ( ( error ) => error . text ( ) ) ;
395
+ expect ( errors ) . toEqual ( [ ] ) ;
396
+ } ) ;
397
+
300
398
it ( 'validates additionalProperties as a valid property' , ( ) => {
301
399
const jsonSchema = {
302
400
$schema : `http://json-schema.org/draft-07/schema#` ,
0 commit comments