Skip to content

Commit

Permalink
Use new interfaces for document field tests (#5241)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored Mar 25, 2021
1 parent 3a9faa4 commit 18f4504
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages-next/fields-document/src/tests/test-fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// @ts-ignore
import { Text } from '@keystone-next/fields-legacy';
import { DocumentFieldType } from '../base-field-type';
import { text } from '@keystone-next/fields';
import { document } from '..';

export const name = 'Document';
export const type = DocumentFieldType;
export const typeFunction = document;
export const exampleValue = () => [{ type: 'paragraph', children: [{ text: '' }] }];
export const exampleValue2 = () => [
{ type: 'heading', children: [{ text: 'heading' }], level: 1 },
{ type: 'paragraph', children: [{ text: '' }] },
];
export const updateReturnedValue = [
{ type: 'paragraph', children: [{ text: 'heading' }] },
{ type: 'paragraph', children: [{ text: '' }] },
];

export const supportsUnique = false;
export const fieldName = 'content';
export const subfieldName = 'document';

export const fieldConfig = () => ({ ___validateAndNormalize: (x: any) => x });

export const getTestFields = () => ({
name: { type: Text },
content: { type, ___validateAndNormalize: (x: any) => x },
});
export const newInterfaces = true;
export const getTestFields = () => ({ name: text(), content: document() });

export const initItems = () => {
return [
Expand Down Expand Up @@ -53,7 +53,7 @@ export const storedValues = () => [
name: 'b',
content: {
document: [
{ type: 'heading', children: [{ text: 'heading' }], level: 1 },
{ type: 'paragraph', children: [{ text: 'heading' }] },
{ type: 'paragraph', children: [{ text: '' }] },
],
},
Expand All @@ -62,7 +62,7 @@ export const storedValues = () => [
name: 'c',
content: {
document: [
{ type: 'blockquote', children: [{ type: 'paragraph', children: [{ text: '' }] }] },
{ type: 'paragraph', children: [{ text: '' }] },
{ type: 'paragraph', children: [{ text: '' }] },
],
},
Expand Down

1 comment on commit 18f4504

@vercel
Copy link

@vercel vercel bot commented on 18f4504 Mar 25, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.