diff --git a/e2e/loop.spec.ts b/e2e/loop.spec.ts index d2c4acbd9..c2e152f42 100644 --- a/e2e/loop.spec.ts +++ b/e2e/loop.spec.ts @@ -6,7 +6,7 @@ loopTypes.forEach((loopType) => { test(`can complete a simple ${loopType.split('--')[0]}`, async ({ page }) => { await goToStory(page, `components-loop-${loopType}`); await page.locator('#prenom-0').fill('John'); - await page.getByRole('button', { name: 'Ajouter un individu' }).click(); + await page.getByRole('button', { name: 'Add row' }).click(); await page.locator('#prenom-1').fill('Jane'); await page.getByRole('button', { name: 'Next' }).click(); await page.getByLabel('John, quel est vôtre âge ?').fill('18'); diff --git a/e2e/pairwise.spec.ts b/e2e/pairwise.spec.ts index d722dabe2..6f5f8754c 100644 --- a/e2e/pairwise.spec.ts +++ b/e2e/pairwise.spec.ts @@ -13,7 +13,7 @@ for (const [label, story] of stories) { test(`can complete ${label} form`, async ({ page }) => { await goToStory(page, story); await page.getByLabel('Prénom').nth(2).fill('Marc'); - await page.getByRole('button', { name: 'Ajouter un individu' }).click(); + await page.getByRole('button', { name: 'Add row' }).click(); await page.getByLabel('Prénom').nth(3).fill('Jane'); await gotoNextPage(page, 4); await page.getByLabel('Âge de Jane').click(); diff --git a/src/components/loop/block-for-loop.tsx b/src/components/loop/block-for-loop.tsx index 14e8266f4..46403e7db 100644 --- a/src/components/loop/block-for-loop.tsx +++ b/src/components/loop/block-for-loop.tsx @@ -1,7 +1,7 @@ import { useCallback, useState } from 'react'; import D from '../../i18n'; import { times } from '../../utils/array'; -import { createCustomizableLunaticField } from '../commons'; +import { createCustomizableLunaticField, Label } from '../commons'; import { DeclarationsAfterText, DeclarationsBeforeText, @@ -65,6 +65,9 @@ export const BlockForLoop = createCustomizableLunaticField< return ( <> + {times(nbRows, (n) => ( @@ -79,7 +82,7 @@ export const BlockForLoop = createCustomizableLunaticField< {canControlRows && ( <> - {label || D.DEFAULT_BUTTON_ADD} + {D.DEFAULT_BUTTON_ADD} {D.DEFAULT_BUTTON_REMOVE} diff --git a/src/components/loop/roster-for-loop/__snapshots__/roster-for-loop.spec.tsx.snap b/src/components/loop/roster-for-loop/__snapshots__/roster-for-loop.spec.tsx.snap index ae4af48b6..5e7de0626 100644 --- a/src/components/loop/roster-for-loop/__snapshots__/roster-for-loop.spec.tsx.snap +++ b/src/components/loop/roster-for-loop/__snapshots__/roster-for-loop.spec.tsx.snap @@ -2,6 +2,13 @@ exports[`RosterForLoop > renders the right number of columns 1`] = `
+ renders the right number of columns 1`] = ` +
@@ -118,7 +120,7 @@ export const RosterForLoop = createCustomizableLunaticField< {showButtons && ( <> - {label || D.DEFAULT_BUTTON_ADD} + {D.DEFAULT_BUTTON_ADD} {D.DEFAULT_BUTTON_REMOVE}