Lexical tests comprise almost half of the collections in the fields suite, and are starting to become complex to manage. They are sometimes related to other auxiliary collections, so refactoring one test sometimes breaks another, seemingly unrelated one. In addition, the fields suite is very large, taking a long time to compile. This will make it faster. Some ideas for future refactorings: - 3 main collections: defaultFeatures, fully featured, and legacy. Legacy is the current one that has multiple editors and could later be migrated to the first two. - Avoid collections with more than 1 editor. - Create reseed buttons to restore the editor to certain states, to avoid a proliferation of collections and documents. - Reduce the complexity of the three auxiliary collections (text, array, upload), which are rarely or never used and have many fields designed for tests in the fields suite.
69 lines
1.0 KiB
TypeScript
69 lines
1.0 KiB
TypeScript
import type { RequiredDataFromCollection } from 'payload/types'
|
|
|
|
import type { ArrayField } from '../../payload-types.js'
|
|
|
|
export const arrayDoc: RequiredDataFromCollection<ArrayField> = {
|
|
arrayWithMinRows: [
|
|
{
|
|
text: 'first row',
|
|
},
|
|
{
|
|
text: 'second row',
|
|
},
|
|
],
|
|
collapsedArray: [
|
|
{
|
|
text: 'initialize collapsed',
|
|
},
|
|
],
|
|
items: [
|
|
{
|
|
text: 'first row',
|
|
},
|
|
{
|
|
text: 'second row',
|
|
},
|
|
{
|
|
text: 'third row',
|
|
},
|
|
{
|
|
text: 'fourth row',
|
|
},
|
|
{
|
|
text: 'fifth row',
|
|
},
|
|
{
|
|
text: 'sixth row',
|
|
},
|
|
],
|
|
title: 'array doc 1',
|
|
}
|
|
|
|
export const anotherArrayDoc: RequiredDataFromCollection<ArrayField> = {
|
|
arrayWithMinRows: [
|
|
{
|
|
text: 'first row',
|
|
},
|
|
{
|
|
text: 'second row',
|
|
},
|
|
],
|
|
collapsedArray: [
|
|
{
|
|
text: 'initialize collapsed',
|
|
},
|
|
],
|
|
items: [
|
|
{
|
|
text: 'first row',
|
|
},
|
|
{
|
|
text: 'second row',
|
|
},
|
|
{
|
|
text: 'third row',
|
|
},
|
|
],
|
|
title: 'array doc 2',
|
|
}
|