Skip to content

Commit

Permalink
[test-studio] Add a fieldsets test type
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Nov 10, 2017
1 parent 6656fc1 commit 111528f
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
70 changes: 70 additions & 0 deletions packages/test-studio/schemas/fieldsets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
export default {
name: 'fieldsetsTest',
type: 'document',
title: 'Fieldsets test',
preview: {
select: {
title: 'myObject.first'
}
},
fieldsets: [{name: 'recursive', title: 'Recursive', options: {collapsable: true}}],
fields: [
{
name: 'myObject',
type: 'myObject',
title: 'MyObject',
description: 'The first field here should be the title'
},
{
name: 'Person',
type: 'object',
fieldsets: [{name: 'social', title: 'Social media handles'}],
fields: [
{
name: 'name',
title: 'Name',
type: 'string'
},
{
name: 'twitter',
title: 'Twitter',
type: 'string',
fieldset: 'social'
},
{
name: 'instagram',
title: 'Instagram',
type: 'string',
fieldset: 'social'
},
{
name: 'facebook',
title: 'Facebook',
type: 'string',
fieldset: 'social'
}
]
},
{
name: 'fieldWithObjectType',
title: 'Field of object type',
type: 'object',
description: 'This is a field of (anonymous, inline) object type. Values here should never get a `_type` property',
fields: [
{name: 'field1', type: 'string', description: 'This is a string field'},
{
name: 'field2',
type: 'myObject',
title: 'A field of myObject',
description: 'This is another field of "myObject"'
},
]
},
{
name: 'recursive',
title: 'This field is of type objectsTest',
type: 'objectsTest',
fieldset: 'recursive'
}
]
}
2 changes: 2 additions & 0 deletions packages/test-studio/schemas/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import datetime from './datetime'
import richDateTest from './richDate'
import slugs from './slugs'
import geopoint from './geopoint'
import fieldsets from './fieldsets'

import customInputs from './customInputs'
import notitle from './notitle'
Expand All @@ -39,6 +40,7 @@ export default createSchema({
booleans,
richDateType,
objects,
fieldsets,
datetime,
richDateTest,
arrays,
Expand Down

0 comments on commit 111528f

Please sign in to comment.