Skip to content

Commit

Permalink
dev(test-studio): add validation to recursive blocks test
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin committed Apr 19, 2023
1 parent 71f0d45 commit 2d3b0cf
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion dev/test-studio/schema/standard/portableText/blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ function CustomEditor(props: PortableTextInputProps) {
return <BlockEditor {...props} markers={newMarkers} />
}

const linkType = defineArrayMember({
type: 'object',
name: 'link',
fields: [
{
type: 'string',
name: 'href',
validation: (Rule) => Rule.uri({scheme: ['http', 'https']}).required(),
},
],
options: {
modal: {
type: 'popover',
width: 2,
},
},
})

export default defineType({
name: 'blocksTest',
title: 'Blocks test',
Expand All @@ -31,7 +49,14 @@ export default defineType({
name: 'first',
title: 'Block array as first field',
type: 'array',
of: [{type: 'block'}],
of: [
{
type: 'block',
marks: {
annotations: [linkType],
},
},
],
},
defineField({
name: 'defaults',
Expand Down

2 comments on commit 2d3b0cf

@vercel
Copy link

@vercel vercel bot commented on 2d3b0cf Apr 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

performance-studio – ./

performance-studio.sanity.build
performance-studio-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 2d3b0cf Apr 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

Please sign in to comment.