test: passing array fields test suite (#5383)
* test: array tests passing except bulk update * test: passing array fields test suite
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
'use client'
|
||||
|
||||
import type { RowLabelComponent } from 'payload/types'
|
||||
|
||||
import React from 'react'
|
||||
|
||||
export const ArrayRowLabel: RowLabelComponent = ({ data }) => {
|
||||
import { useRowLabel } from '../../../../packages/ui/src/forms/RowLabel/Context/index.js'
|
||||
|
||||
export const ArrayRowLabel: RowLabelComponent = () => {
|
||||
const { data } = useRowLabel<{ title: string }>()
|
||||
return (
|
||||
<div style={{ color: 'coral', textTransform: 'uppercase' }}>{data.title || 'Untitled'}</div>
|
||||
)
|
||||
|
||||
@@ -112,22 +112,6 @@ const ArrayFields: CollectionConfig = {
|
||||
],
|
||||
type: 'array',
|
||||
},
|
||||
{
|
||||
name: 'rowLabelAsFunction',
|
||||
admin: {
|
||||
components: {
|
||||
RowLabel: ({ data }) => data.title,
|
||||
},
|
||||
description: 'Row labels rendered from a function.',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
type: 'array',
|
||||
},
|
||||
{
|
||||
name: 'rowLabelAsComponent',
|
||||
admin: {
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
import type { ArrayField } from '../../payload-types.js'
|
||||
|
||||
export const arrayDoc: Partial<ArrayField> = {
|
||||
title: 'array doc 1',
|
||||
arrayWithMinRows: [
|
||||
{
|
||||
text: 'first row',
|
||||
},
|
||||
{
|
||||
text: 'second row',
|
||||
},
|
||||
],
|
||||
collapsedArray: [
|
||||
{
|
||||
text: 'initialize collapsed',
|
||||
},
|
||||
],
|
||||
items: [
|
||||
{
|
||||
text: 'first row',
|
||||
@@ -22,11 +34,10 @@ export const arrayDoc: Partial<ArrayField> = {
|
||||
text: 'sixth row',
|
||||
},
|
||||
],
|
||||
collapsedArray: [
|
||||
{
|
||||
text: 'initialize collapsed',
|
||||
},
|
||||
],
|
||||
title: 'array doc 1',
|
||||
}
|
||||
|
||||
export const anotherArrayDoc: Partial<ArrayField> = {
|
||||
arrayWithMinRows: [
|
||||
{
|
||||
text: 'first row',
|
||||
@@ -35,10 +46,11 @@ export const arrayDoc: Partial<ArrayField> = {
|
||||
text: 'second row',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
export const anotherArrayDoc: Partial<ArrayField> = {
|
||||
title: 'array doc 2',
|
||||
collapsedArray: [
|
||||
{
|
||||
text: 'initialize collapsed',
|
||||
},
|
||||
],
|
||||
items: [
|
||||
{
|
||||
text: 'first row',
|
||||
@@ -50,17 +62,5 @@ export const anotherArrayDoc: Partial<ArrayField> = {
|
||||
text: 'third row',
|
||||
},
|
||||
],
|
||||
collapsedArray: [
|
||||
{
|
||||
text: 'initialize collapsed',
|
||||
},
|
||||
],
|
||||
arrayWithMinRows: [
|
||||
{
|
||||
text: 'first row',
|
||||
},
|
||||
{
|
||||
text: 'second row',
|
||||
},
|
||||
],
|
||||
title: 'array doc 2',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user