fix: relationship field useAsTitle #2333 (#2350)

This commit is contained in:
Jacob Fletcher
2023-03-20 22:21:49 -04:00
committed by GitHub
parent c8594a7e7a
commit 10dd819863
16 changed files with 172 additions and 50 deletions

View File

@@ -142,9 +142,22 @@ export default buildConfig({
{
slug: relationWithTitleSlug,
admin: {
useAsTitle: 'name',
useAsTitle: 'meta.title',
},
fields: baseRelationshipFields,
fields: [
...baseRelationshipFields,
{
name: 'meta',
type: 'group',
fields: [
{
name: 'title',
label: 'Meta Title',
type: 'text',
},
],
},
],
},
{
slug: relationUpdatedExternallySlug,
@@ -297,6 +310,9 @@ export default buildConfig({
collection: relationWithTitleSlug,
data: {
name: title,
meta: {
title,
},
},
});
relationsWithTitle.push(id);

View File

@@ -17,7 +17,6 @@ import wait from '../../src/utilities/wait';
const { beforeAll, beforeEach, describe } = test;
describe('fields - relationship', () => {
let url: AdminUrlUtil;
let page: Page;
@@ -80,6 +79,9 @@ describe('fields - relationship', () => {
collection: relationWithTitleSlug,
data: {
name: 'relation-title',
meta: {
title: 'relation-title',
},
},
});
@@ -88,6 +90,9 @@ describe('fields - relationship', () => {
collection: relationWithTitleSlug,
data: {
name: 'word boundary search',
meta: {
title: 'word boundary search',
},
},
});
@@ -309,7 +314,7 @@ describe('fields - relationship', () => {
const options = page.locator('#field-relationshipWithTitle .rs__menu .rs__option');
await expect(options).toHaveCount(1);
await input.fill('non-occuring-string');
await input.fill('non-occurring-string');
await expect(options).toHaveCount(0);
});