diff --git a/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx b/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx index fe6536a00..f18f1ead8 100644 --- a/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx +++ b/src/layout/RepeatingGroup/Summary2/RepeatingGroupTableSummary/RepeatingGroupTableSummary.tsx @@ -84,23 +84,14 @@ export const RepeatingGroupTableSummary = ({ - {rows.map((row) => ( - - {childNodes.map((node) => ( - - ))} - {!pdfModeActive && ( - - {row?.itemIds && row?.itemIds?.length > 0 && } - - )} - + {rows.map((row, index) => ( + ))} @@ -133,16 +124,40 @@ function HeaderCell({ node, columnSettings }: { node: LayoutNode; columnSettings ); } -function DataCell({ node }) { - const { langAsString } = useLanguage(); +function DataRow({ row, node, index, pdfModeActive }) { + const cellNodes = useTableNodes(node, index); const displayDataProps = useDisplayDataProps(); + + return ( + + {cellNodes.map((node) => ( + + ))} + {!pdfModeActive && ( + + {row?.itemIds && row?.itemIds?.length > 0 && } + + )} + + ); +} + +function DataCell({ node, displayData }) { + const { langAsString } = useLanguage(); const headerTitle = langAsString(useTableTitle(node)); return ( - {'getDisplayData' in node.def && node.def.getDisplayData(node as never, displayDataProps)} + {displayData} ); } diff --git a/test/e2e/integration/component-library/repeating-group.ts b/test/e2e/integration/component-library/repeating-group.ts index d21f1c451..e478f90cb 100644 --- a/test/e2e/integration/component-library/repeating-group.ts +++ b/test/e2e/integration/component-library/repeating-group.ts @@ -25,6 +25,7 @@ describe('Group summary test', () => { it('Displays a summary for a filled repeating group in table', () => { const inputValue = 'Test input for group'; + const inputValue2 = 'Test input for group2'; cy.findAllByRole('button', { name: /Legg til ny/ }) .first() @@ -36,7 +37,7 @@ describe('Group summary test', () => { cy.findAllByRole('button', { name: /Legg til ny/ }) .first() .click(); - cy.findByRole('textbox', { name: /Navn/ }).type(inputValue); + cy.findByRole('textbox', { name: /Navn/ }).type(inputValue2); cy.findAllByRole('button', { name: /Lagre og lukk/ }) .first() .click(); @@ -44,7 +45,8 @@ describe('Group summary test', () => { cy.get('div[data-testid="summary-repeating-group-component"] > table').within(() => { cy.findAllByRole('row').should('have.length', 3); cy.findByRole('columnheader', { name: /Navn/ }).should('exist'); - cy.findAllByRole('cell', { name: inputValue }).first().should('exist'); + cy.findAllByRole('cell', { name: inputValue }).should('exist'); + cy.findAllByRole('cell', { name: inputValue2 }).should('exist'); }); });