From ec8cd0750f016185b0f61643c3d25ba52285f1f7 Mon Sep 17 00:00:00 2001 From: Myrta Sakellariou Date: Fri, 15 Nov 2024 11:25:03 +0100 Subject: [PATCH] test fix --- .../validation/validation.snapshot.stories.ts | 405 +++++++++--------- 1 file changed, 210 insertions(+), 195 deletions(-) diff --git a/packages/documentation/src/stories/components/forms/validation/validation.snapshot.stories.ts b/packages/documentation/src/stories/components/forms/validation/validation.snapshot.stories.ts index 0daa8ca7be..bd7d8e0baa 100644 --- a/packages/documentation/src/stories/components/forms/validation/validation.snapshot.stories.ts +++ b/packages/documentation/src/stories/components/forms/validation/validation.snapshot.stories.ts @@ -23,146 +23,213 @@ export const Validation: Story = { { name: 'TextArea', id: 'TextArea_1' }, ]; - const validationStates = ['null', 'is-valid', 'is-invalid']; + const validationStates = ['is-valid', 'is-invalid']; - return html` -
- ${[ - { scheme: 'light', bg: 'white' }, - { scheme: 'dark', bg: 'dark' }, - ].map( - ({ scheme, bg }) => html`
- ${components.map( - component => - html` -
-

${component.name}

- ${validationStates.map(state => { - const isValidationSet = state !== 'null'; - const isValid = state === 'is-valid'; - const isInvalid = state === 'is-invalid'; - const ariaInvalid = isValidationSet ? isInvalid : nothing; - const ariaDescribedBy = isValidationSet ? `${state}-id` : nothing; - const validFeedbackId = - isValidationSet && isValid ? `${state}-id` : nothing; - const invalidFeedbackId = - isValidationSet && isInvalid ? `${state}-id` : nothing; + return html`
+ ${[ + { scheme: 'light', bg: 'white' }, + { scheme: 'dark', bg: 'dark' }, + ].map( + ({ scheme, bg }) => html` +
+ ${components.map( + component => + html` +
+

${component.name}

+ ${validationStates.map(state => { + const isValid = state === 'is-valid'; + const isInvalid = state === 'is-invalid'; + const ariaInvalid = isInvalid ? 'true' : nothing; + const ariaDescribedBy = isValid + ? `${state}-id-${component.name}-${scheme}-${state}` + : nothing; + const validFeedbackId = isValid + ? `${state}-id-${component.name}-${scheme}-${state}` + : nothing; + const invalidFeedbackId = isInvalid + ? `${state}-id-${component.name}-${scheme}-${state}` + : nothing; - // Wrap each state variation in a div - return html` -
- ${(() => { - switch (component.name) { - case 'CardControl': - return html` -
- - -
+ return html` +
+ ${(() => { + switch (component.name) { + case 'CardControl': + return html` +
+ + +
+

+ Valid message. +

+

+ Invalid message. +

+ `; + case 'Checkbox': + return html` +
+ +

Valid message.

Invalid message.

- `; - case 'Checkbox': - return html` -
- - -

- Valid message. -

-

- Invalid message. -

-
- `; - case 'Input': - return html` -
- - -

- Hintus textus elare volare cantare hendrerit in vulputate - velit esse molestie consequat, vel illum dolore eu feugiat - nulla facilisis. -

-

- Valid message. -

-

- Invalid message. -

-
- `; - case 'RadioButton': - return html` -
- - -

- Valid message. -

-

- Invalid message. -

-
- `; - case 'Select': - return html`
- + +

+ Hintus textus elare volare cantare hendrerit in vulputate + velit esse molestie consequat, vel illum dolore eu feugiat + nulla facilisis. +

+

+ Valid message. +

+

+ Invalid message. +

+
+ `; + case 'RadioButton': + return html` +
+ +
+ `; + case 'Select': + return html`
+ + +

+ Hintus textus elare volare cantare hendrerit in vulputate velit + esse molestie consequat, vel illum dolore eu feugiat nulla + facilisis. +

+

+ Valid message. +

+

+ Invalid message. +

+
`; + case 'Switch': + return html` +
+ + +

+ Valid message. +

+

+ Invalid message. +

+
+ `; + case 'TextArea': + return html` +
+ +

Hintus textus elare volare cantare hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat @@ -174,73 +241,21 @@ export const Validation: Story = {

Invalid message.

-
`; - case 'Switch': - return html` -
- - -

- Valid message. -

-

- Invalid message. -

-
- `; - case 'TextArea': - return html` -
- - -

- Hintus textus elare volare cantare hendrerit in vulputate - velit esse molestie consequat, vel illum dolore eu feugiat - nulla facilisis. -

-

- Valid message. -

-

- Invalid message. -

-
- `; - default: - return nothing; - } - })()} -
- `; - })} -
- `, - )} -
-
`, - )} -
- `; +
+ `; + default: + return nothing; + } + })()} +
+ `; + })} +
+ `, + )} +
+ `, + )} + `; }, };