Skip to content

Commit

Permalink
✅ [open-formulieren/open-forms#3778] Test summary of fields with empt…
Browse files Browse the repository at this point in the history
…y names
  • Loading branch information
SilviaAmAm committed Jan 18, 2024
1 parent 91f741a commit 68d518d
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions src/components/Summary/Summary.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 68d518d

Please sign in to comment.