fix(next): unnamed, unlabeled groups displayed without label in version view (#13831)
Before, unnamed, unlabelled group were part of an unlabeled collapsible in the version diff view. This means, all it displayed was a clickable, empty rectangle. This looks like a bug rather than intended. This PR displays a new <Unnamed Group> label in these cases. It also fixes the incorrect `NamedGroupFieldClient` type. Previously, that type did not include the `name` property, even though it was available on the client. Before: <img width="2372" height="688" alt="Screenshot 2025-09-16 at 18 57 45@2x" src="https://github.com/user-attachments/assets/0f351f84-a00f-4067-aa40-d0e8fbfd5f0b" /> After: <img width="2326" height="598" alt="Screenshot 2025-09-16 at 18 56 14@2x" src="https://github.com/user-attachments/assets/bddee841-8218-4a90-a052-9875c5f252c0" /> --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1211375615406676
This commit is contained in:
@@ -151,6 +151,25 @@ export const Diff: CollectionConfig = {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'group',
|
||||
fields: [
|
||||
{
|
||||
name: 'textInUnnamedGroup',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'group',
|
||||
label: 'Unnamed Labeled Group',
|
||||
fields: [
|
||||
{
|
||||
name: 'textInUnnamedLabeledGroup',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
name: 'number',
|
||||
|
||||
@@ -94,7 +94,6 @@ describe('Versions', () => {
|
||||
let customIDURL: AdminUrlUtil
|
||||
let postURL: AdminUrlUtil
|
||||
let errorOnUnpublishURL: AdminUrlUtil
|
||||
let id: string
|
||||
|
||||
beforeAll(async ({ browser }, testInfo) => {
|
||||
testInfo.setTimeout(TEST_TIMEOUT_LONG)
|
||||
@@ -1119,7 +1118,7 @@ describe('Versions', () => {
|
||||
timeout: POLL_TOPASS_TIMEOUT,
|
||||
})
|
||||
|
||||
id = await page.locator('.id-label').getAttribute('title')
|
||||
const id = await page.locator('.id-label').getAttribute('title')
|
||||
|
||||
const data = await payload.find({
|
||||
collection: localizedCollectionSlug,
|
||||
@@ -1866,15 +1865,45 @@ describe('Versions', () => {
|
||||
await expect(email.locator('.html-diff__diff-new')).toHaveText('email2@email.com')
|
||||
})
|
||||
|
||||
test('correctly renders diff for group fields', async () => {
|
||||
test('correctly renders diff for named group fields', async () => {
|
||||
await navigateToDiffVersionView()
|
||||
|
||||
await expect(
|
||||
page.locator('[data-field-path="group"] .diff-collapser__label').first(),
|
||||
).toHaveText('Group')
|
||||
|
||||
const group = page.locator('[data-field-path="group.textInGroup"]')
|
||||
|
||||
await expect(group.locator('.html-diff__diff-old')).toHaveText('textInGroup')
|
||||
await expect(group.locator('.html-diff__diff-new')).toHaveText('textInGroup2')
|
||||
})
|
||||
|
||||
test('correctly renders diff for unnamed, unlabeled group fields', async () => {
|
||||
await navigateToDiffVersionView()
|
||||
|
||||
await expect(
|
||||
page.locator('[data-field-path="_index-9"] .diff-collapser__label').first(),
|
||||
).toHaveText('<Unnamed Group>')
|
||||
|
||||
const group = page.locator('[data-field-path="textInUnnamedGroup"]')
|
||||
|
||||
await expect(group.locator('.html-diff__diff-old')).toHaveText('textInUnnamedGroup')
|
||||
await expect(group.locator('.html-diff__diff-new')).toHaveText('textInUnnamedGroup2')
|
||||
})
|
||||
|
||||
test('correctly renders diff for unnamed, labeled group fields', async () => {
|
||||
await navigateToDiffVersionView()
|
||||
|
||||
await expect(
|
||||
page.locator('[data-field-path="_index-10"] .diff-collapser__label').first(),
|
||||
).toHaveText('Unnamed Labeled Group')
|
||||
|
||||
const group = page.locator('[data-field-path="textInUnnamedLabeledGroup"]')
|
||||
|
||||
await expect(group.locator('.html-diff__diff-old')).toHaveText('textInUnnamedLabeledGroup')
|
||||
await expect(group.locator('.html-diff__diff-new')).toHaveText('textInUnnamedLabeledGroup2')
|
||||
})
|
||||
|
||||
test('correctly renders diff for number fields', async () => {
|
||||
await navigateToDiffVersionView()
|
||||
|
||||
|
||||
@@ -457,6 +457,8 @@ export interface Diff {
|
||||
group?: {
|
||||
textInGroup?: string | null;
|
||||
};
|
||||
textInUnnamedGroup?: string | null;
|
||||
textInUnnamedLabeledGroup?: string | null;
|
||||
number?: number | null;
|
||||
/**
|
||||
* @minItems 2
|
||||
@@ -1112,6 +1114,8 @@ export interface DiffSelect<T extends boolean = true> {
|
||||
| {
|
||||
textInGroup?: T;
|
||||
};
|
||||
textInUnnamedGroup?: T;
|
||||
textInUnnamedLabeledGroup?: T;
|
||||
number?: T;
|
||||
point?: T;
|
||||
json?: T;
|
||||
|
||||
@@ -243,6 +243,8 @@ export async function seed(_payload: Payload, parallel: boolean = false) {
|
||||
code: 'code',
|
||||
date: '2021-04-01T00:00:00.000Z',
|
||||
email: 'email@email.com',
|
||||
textInUnnamedGroup: 'textInUnnamedGroup',
|
||||
textInUnnamedLabeledGroup: 'textInUnnamedLabeledGroup',
|
||||
group: {
|
||||
textInGroup: 'textInGroup',
|
||||
},
|
||||
@@ -386,6 +388,8 @@ export async function seed(_payload: Payload, parallel: boolean = false) {
|
||||
code: 'code2',
|
||||
date: '2023-04-01T00:00:00.000Z',
|
||||
email: 'email2@email.com',
|
||||
textInUnnamedGroup: 'textInUnnamedGroup2',
|
||||
textInUnnamedLabeledGroup: 'textInUnnamedLabeledGroup2',
|
||||
group: {
|
||||
textInGroup: 'textInGroup2',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user