From 91f741abd57e1e9b12c1b989d0ce59de09d7648e Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Thu, 18 Jan 2024 08:57:56 +0100 Subject: [PATCH 1/2] :bug: [open-formulieren/open-forms#3778] Content component should not render name --- src/components/FormStepSummary/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/FormStepSummary/index.js b/src/components/FormStepSummary/index.js index 26f347b1b..7ea662455 100644 --- a/src/components/FormStepSummary/index.js +++ b/src/components/FormStepSummary/index.js @@ -14,8 +14,11 @@ import {DEBUG} from 'utils'; import ComponentValueDisplay from './ComponentValueDisplay'; +// Components without a label that should still be displayed +const COMPONENTS_WITH_NO_NAME = ['content']; + const LabelValueRow = ({name, value, component}) => { - if (!name) { + if (!name && !COMPONENTS_WITH_NO_NAME.includes(component.type)) { return null; } From 68d518da6bdc7fc3786c4ceaf65e81a5cc4fe45d Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Thu, 18 Jan 2024 10:52:38 +0100 Subject: [PATCH 2/2] :white_check_mark: [open-formulieren/open-forms#3778] Test summary of fields with empty names --- src/components/Summary/Summary.stories.js | 97 +++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/src/components/Summary/Summary.stories.js b/src/components/Summary/Summary.stories.js index 16e73824b..6e832cd2d 100644 --- a/src/components/Summary/Summary.stories.js +++ b/src/components/Summary/Summary.stories.js @@ -25,6 +25,15 @@ export default { slug: 'uw-gegevens', name: 'Uw gegevens', data: [ + { + name: '', + value: 'In this section you can enter your personal details.', + component: { + type: 'content', + label: 'Content', + key: 'content', + }, + }, { name: 'Voornaam', value: 'John', @@ -61,6 +70,36 @@ export default { slug: 'uw-partner', name: 'Uw partner', data: [ + { + name: 'Partner details', + value: null, + component: { + type: 'fieldset', + key: 'fieldset1', + label: 'Partner details', + hideLabel: false, + components: [ + { + key: 'voornaam2', + type: 'textfield', + label: 'Voornaam', + hidden: false, + }, + { + key: 'achternaam2', + type: 'textfield', + label: 'Achternaam', + hidden: false, + }, + { + key: 'emailAdres2', + type: 'email', + label: 'Email adres', + hidden: false, + }, + ], + }, + }, { name: 'Voornaam', value: 'Carl', @@ -93,6 +132,40 @@ export default { }, ], }, + { + slug: 'uw-huisdier', + name: 'Uw huisdier', + data: [ + { + name: '', + value: null, + component: { + type: 'fieldset', + key: 'fieldset2', + label: 'Pet details', + hideLabel: true, + components: [ + { + key: 'huisdierNaam', + type: 'textfield', + label: 'Huisdier naam', + hidden: false, + }, + ], + }, + }, + { + name: 'Huisdier Naam', + value: 'Nemo', + component: { + key: 'huisdierNaam', + type: 'textfield', + label: 'Huisdier naam', + hidden: false, + }, + }, + ], + }, ], showPaymentInformation: true, amountToPay: 54.05, @@ -191,6 +264,30 @@ const render = ({ export const Default = { render, + play: async ({canvasElement, step}) => { + const canvas = within(canvasElement); + + const contentNodes = canvas.getAllByText((content, element) => { + return element.className.split(' ').includes('utrecht-data-list__item--openforms-content'); + }); + + await expect(contentNodes.length).toEqual(1); + + const contentNode = contentNodes[0]; + + await expect(contentNode.firstChild.textContent).toEqual(''); + + const fieldsetNodes = canvas.getAllByText((content, element) => { + return element.className.split(' ').includes('utrecht-data-list__item--openforms-fieldset'); + }); + + // The fieldset with hidden label is not rendered + await expect(fieldsetNodes.length).toEqual(1); + + const fieldsetPartnerNode = fieldsetNodes[0]; + + await expect(fieldsetPartnerNode.firstChild.textContent).toEqual('Partner details'); + }, }; export const MultipleRequiredStatements = {