From dbca516e7bd087e69981ef3d22afdedbd7dc9232 Mon Sep 17 00:00:00 2001 From: Adrien L Date: Mon, 16 Jun 2025 10:50:05 +0200 Subject: [PATCH] fix: min/max value for components not clear (#23741) --- .../FormModal/attributes/advancedForm.ts | 18 ++++++++++++++++-- .../admin/src/translations/en.json | 2 ++ .../admin/src/translations/fr.json | 4 ++++ .../tests/review-workflows/settings.spec.ts | 10 ++++------ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/packages/core/content-type-builder/admin/src/components/FormModal/attributes/advancedForm.ts b/packages/core/content-type-builder/admin/src/components/FormModal/attributes/advancedForm.ts index 9c7ca3c4c2..8ce2f385e8 100644 --- a/packages/core/content-type-builder/admin/src/components/FormModal/attributes/advancedForm.ts +++ b/packages/core/content-type-builder/admin/src/components/FormModal/attributes/advancedForm.ts @@ -69,6 +69,20 @@ export const advancedForm = { } if (repeatable) { + const minComponentsAttribute = { + ...attributeOptions.min, + intlLabel: { + id: getTrad('form.attribute.item.minimumComponents'), + defaultMessage: 'Minimum components', + }, + }; + const maxComponentsAttribute = { + ...attributeOptions.max, + intlLabel: { + id: getTrad('form.attribute.item.maximumComponents'), + defaultMessage: 'Maximum components', + }, + }; return { sections: [ { @@ -79,8 +93,8 @@ export const advancedForm = { items: [ attributeOptions.required, attributeOptions.private, - attributeOptions.max, - attributeOptions.min, + minComponentsAttribute, + maxComponentsAttribute, ], }, ], diff --git a/packages/core/content-type-builder/admin/src/translations/en.json b/packages/core/content-type-builder/admin/src/translations/en.json index 2aad837c3e..e846704a46 100644 --- a/packages/core/content-type-builder/admin/src/translations/en.json +++ b/packages/core/content-type-builder/admin/src/translations/en.json @@ -89,8 +89,10 @@ "form.attribute.item.enumeration.placeholder": "Ex:\nmorning\nnoon\nevening", "form.attribute.item.enumeration.rules": "Values (one line per value)", "form.attribute.item.maximum": "Maximum value", + "form.attribute.item.maximumComponents": "Maximum components", "form.attribute.item.maximumLength": "Maximum length", "form.attribute.item.minimum": "Minimum value", + "form.attribute.item.minimumComponents": "Minimum components", "form.attribute.item.minimumLength": "Minimum length", "form.attribute.item.number.type": "Number format", "form.attribute.item.number.type.biginteger": "big integer (ex: 123456789)", diff --git a/packages/core/content-type-builder/admin/src/translations/fr.json b/packages/core/content-type-builder/admin/src/translations/fr.json index 0f878c84df..12a786231e 100644 --- a/packages/core/content-type-builder/admin/src/translations/fr.json +++ b/packages/core/content-type-builder/admin/src/translations/fr.json @@ -22,8 +22,12 @@ "form.attribute.item.enumeration.placeholder": "Ex:\nmatin\nmidi\nsoir", "form.attribute.item.enumeration.rules": "Valeurs (les séparer par une nouvelle ligne)", "form.attribute.item.maximum": "Valeur maximum", + "form.attribute.item.maximumComponents": "Composants maximum", + "form.attribute.item.maximumComponents.description": "Nombre maximum de composants", "form.attribute.item.maximumLength": "Taille maximum", "form.attribute.item.minimum": "Valeur minimun", + "form.attribute.item.minimumComponents": "Composants minimun", + "form.attribute.item.minimumComponents.description": "Nombre minimum de composants", "form.attribute.item.minimumLength": "Taille minimun", "form.attribute.item.number.type": "Format nombre", "form.attribute.item.number.type.decimal": "décimal approximatif (ex: 2,22)", diff --git a/tests/e2e/tests/review-workflows/settings.spec.ts b/tests/e2e/tests/review-workflows/settings.spec.ts index 063482c821..606e466af1 100644 --- a/tests/e2e/tests/review-workflows/settings.spec.ts +++ b/tests/e2e/tests/review-workflows/settings.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test'; import { login } from '../../utils/login'; import { resetDatabaseAndImportDataFromPath } from '../../utils/dts-import'; -import { describeOnCondition, findAndClose } from '../../utils/shared'; +import { clickAndWait, describeOnCondition, findAndClose } from '../../utils/shared'; const edition = process.env.STRAPI_DISABLE_EE === 'true' ? 'CE' : 'EE'; @@ -139,12 +139,10 @@ describeOnCondition(edition === 'EE')('settings', () => { await expect(requiredStageCombobox).toBeVisible(); await expect(requiredStageCombobox.locator('span').first()).toHaveText('Done'); - // Navigate to Content Manager to check validation is working - await page.getByRole('link', { name: 'Content Manager' }).click(); - // Go to the entry - await page.getByRole('link', { name: 'Content Manager' }).click(); - await page.getByRole('link', { name: 'Author' }).click(); + await clickAndWait(page, page.getByRole('link', { name: 'Content Manager' })); + await clickAndWait(page, page.getByRole('link', { name: 'Author' })); + await page.getByRole('gridcell', { name: 'Ted Lasso' }).click(); await page.getByRole('textbox', { name: 'Name' }).fill('Ted Laso');