diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java index d6588b987d..eebefaab08 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImpl.java @@ -29,6 +29,7 @@ import com.adobe.cq.export.json.ComponentExporter; import com.adobe.cq.export.json.ExporterConstants; import com.adobe.cq.forms.core.components.internal.form.FormConstants; +import com.adobe.cq.forms.core.components.models.form.FieldType; import com.adobe.cq.forms.core.components.models.form.Password; import com.adobe.cq.forms.core.components.util.AbstractFieldImpl; import com.adobe.cq.forms.core.components.util.ComponentUtils; @@ -47,11 +48,11 @@ public class PasswordImpl extends AbstractFieldImpl implements Password { @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL) @Nullable - private String validationPattern; + private String pattern; @Override public String getFieldType() { - return super.getFieldType(); + return getFieldType(FieldType.PASSWORD); } @Override @@ -64,34 +65,14 @@ public Integer getMaxLength() { return maxLength; } - @Override - public Long getMinimum() { - return minimum; - } - - @Override - public Long getMaximum() { - return maximum; - } - @Override public String getFormat() { return displayFormat; } @Override - public String getValidationPattern() { - return validationPattern; - } - - @Override - public Long getExclusiveMaximum() { - return (Long) exclusiveMaximumValue; - } - - @Override - public Long getExclusiveMinimum() { - return (Long) exclusiveMinimumVaue; + public String getPattern() { + return pattern; } @PostConstruct diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java index 9eff634a66..58fb6fb702 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java @@ -36,7 +36,6 @@ public enum FieldType { FORM("form"), CHECKBOX_GROUP("checkbox-group"), IMAGE("image"), - TELEPHONE("tel"), PASSWORD("password"), RANGE("range"), diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java index 9d78a1148a..353f4aa2cf 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/Password.java @@ -21,17 +21,9 @@ /** * Interface for {@code Password} Sling Model used for the {@code /apps/core/fd/components/form/password/v1/password} component. * - * @since com.adobe.cq.forms.core.components.models.form 2.0.0 + * @since com.adobe.cq.forms.core.components.models.form 5.9.6 */ @ConsumerType -public interface Password extends Field, StringConstraint, NumberConstraint { - - /** - * Returns the validation pattern (regex) for the password field. - * - * @return the validation pattern - * @since com.adobe.cq.forms.core.components.models.form 2.0.0 - */ - String getValidationPattern(); +public interface Password extends Field, StringConstraint { } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java index cf75eed440..98e18c1cd4 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/PasswordImplTest.java @@ -16,6 +16,8 @@ package com.adobe.cq.forms.core.components.internal.models.v1.form; +import com.adobe.cq.forms.core.components.internal.form.FormConstants; +import com.adobe.cq.forms.core.components.models.form.TextInput; import org.apache.commons.lang3.reflect.FieldUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -28,6 +30,7 @@ import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext; import io.wcm.testing.mock.aem.junit5.AemContext; import io.wcm.testing.mock.aem.junit5.AemContextExtension; +import org.mockito.Mockito; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -39,8 +42,10 @@ public class PasswordImplTest { private static final String CONTENT_ROOT = "/content"; private static final String PATH_PASSWORD_DATALAYER = CONTENT_ROOT + "/password-datalayer"; private static final String PATH_PASSWORD_CUSTOMIZED = CONTENT_ROOT + "/password-customized"; - private static final String PATH_NUMBER_PASSWORD_EXCLUSIVE = CONTENT_ROOT + "/number-password-exclusive"; - private static final String PATH_NUMBER_PASSWORD_INPUT = CONTENT_ROOT + "/number-password"; + + private static final String PATH_PASSWORD = CONTENT_ROOT + "/password"; + + private static final String PATH_PASSWORD_PATTERN = CONTENT_ROOT + "/password-pattern"; private final AemContext context = FormsCoreComponentTestContext.newAemContext(); @@ -49,6 +54,21 @@ void setUp() { context.load().json(BASE + FormsCoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT); } + @Test + void testExportedType() { + Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context); + assertEquals(FormConstants.RT_FD_FORM_PASSWORD_V1, password.getExportedType()); + TextInput textInputMock = Mockito.mock(TextInput.class); + Mockito.when(textInputMock.getExportedType()).thenCallRealMethod(); + assertEquals("", textInputMock.getExportedType()); + } + + @Test + void testJSONExport() throws Exception { + Password password = Utils.getComponentUnderTest(PATH_PASSWORD_PATTERN, Password.class, context); + Utils.testJSONExport(password, Utils.getTestExporterJSONPath(BASE, PATH_PASSWORD)); + } + @Test void testFieldType() { Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context); @@ -98,7 +118,7 @@ void testGetRequired() { @Test void testGetValidationPattern() { Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context); - assertEquals("/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/", password.getValidationPattern()); + assertEquals("/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/", password.getPattern()); } @@ -138,38 +158,18 @@ void testMaxLength() { assertEquals(10, password.getMaxLength().intValue()); } - @Test - void testGetExclusiveMinimum() { - Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_EXCLUSIVE, Password.class, context); - assertNull(password.getMinimum()); - assertEquals(8L, password.getExclusiveMinimum().longValue()); - } - - @Test - void testGetExclusiveMaximum() { - Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_EXCLUSIVE, Password.class, context); - assertNull(password.getMaximum()); - assertEquals(16L, password.getExclusiveMaximum().longValue()); - } - - @Test - void testGetMinimum() { - Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_INPUT, Password.class, context); - assertEquals(8, password.getMinimum().intValue()); - } - - @Test - void testGetMaximum() { - Password password = Utils.getComponentUnderTest(PATH_NUMBER_PASSWORD_INPUT, Password.class, context); - assertEquals(16, password.getMaximum().intValue()); - } - @Test void testGetDisplayFormat() throws Exception { Password password = Utils.getComponentUnderTest(PATH_PASSWORD_CUSTOMIZED, Password.class, context); assertEquals("password", password.getFormat()); } + @Test + void testGetPattern() throws Exception { + Password password = Utils.getComponentUnderTest(PATH_PASSWORD_PATTERN, Password.class, context); + assertEquals("^(?=.*\\d.*\\d)[A-Za-z\\d!@]+$", password.getPattern()); + } + @Test void testDataLayerProperties() throws IllegalAccessException { Password password = Utils.getComponentUnderTest(PATH_PASSWORD_DATALAYER, Password.class, context); diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json index 02bd02f46b..d4fe91715c 100644 --- a/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json +++ b/bundles/af-core/src/test/resources/form/password/exporter-password-customized.json @@ -21,7 +21,7 @@ "minimum" : 1, "exclusiveMinimum" : 8, "exclusiveMaximum" : 16, - "validationPattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/", + "pattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/", "label": { "value": "Password", "visible": true diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json b/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json index ab723a1dd2..6dafe57656 100644 --- a/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json +++ b/bundles/af-core/src/test/resources/form/password/exporter-password-datalayer.json @@ -1,7 +1,7 @@ { "id": "password-1c7bc238a6", "fieldType": "password", - "name": "Full Name", + "name": "password1732094911597", "visible": true, "description": "Enter Full Name", "tooltip": "Full Name", diff --git a/bundles/af-core/src/test/resources/form/password/exporter-password.json b/bundles/af-core/src/test/resources/form/password/exporter-password.json new file mode 100644 index 0000000000..148a0b951e --- /dev/null +++ b/bundles/af-core/src/test/resources/form/password/exporter-password.json @@ -0,0 +1,26 @@ +{ + "id": "password-91417957c6", + "fieldType": "password", + "name": "password1732174214265", + "visible": true, + "type": "string", + "enabled": true, + "readOnly": false, + "pattern": "^(?=.*\\d.*\\d)[A-Za-z\\d!@]+$", + "label": { + "value": "" + }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "properties": { + ":type": "forms-components-examples/components/form/password", + "fd:dor": { + "dorExclusion": false + }, + "fd:path": "/content/password-pattern" + }, + ":type": "nt:unstructured" +} \ No newline at end of file diff --git a/bundles/af-core/src/test/resources/form/password/test-content.json b/bundles/af-core/src/test/resources/form/password/test-content.json index 10748c1807..248ed69717 100644 --- a/bundles/af-core/src/test/resources/form/password/test-content.json +++ b/bundles/af-core/src/test/resources/form/password/test-content.json @@ -29,7 +29,7 @@ "typeMessage" : "incorrect type", "tooltip": "test-short-description", "placeholder": "Enter valid password", - "validationPattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/", + "pattern": "/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/", "default" : "password", "fieldType": "password", "label": { @@ -37,46 +37,36 @@ "visible": true } }, - "number-password" : { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType" : "core/fd/components/form/textinput/v1/textinput", - "name" : "abc", - "type" : "password", - "jcr:title" : "def", - "hideTitle" : false, - "description" : "dummy", - "visible" : false, - "assistPriority" : "custom", - "dataRef" : "a.b", - "custom" : "Custom screen reader text", - "typeMessage" : "incorrect type", - "tooltip": "test-short-description", - "fieldType": "text-input", - "maximum" : 16, - "minimum" : 8, - "default" : 150 - }, - "number-password-exclusive" : { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType" : "core/fd/components/form/password/v1/password", - "name" : "abc", - "type" : "password", - "jcr:title" : "def", - "hideTitle" : false, - "description" : "dummy", - "visible" : false, - "assistPriority" : "custom", - "dataRef" : "a.b", - "custom" : "Custom screen reader text", - "typeMessage" : "incorrect type", - "tooltip": "test-short-description", - "fieldType": "text-input", - "maximum" : 16, - "minimum" : 8, - "exclusiveMinimum" : true, - "exclusiveMaximum" : true, - "default" : 150 + "password-pattern" : { + "id": "password-91417957c6", + "fieldType": "password", + "name": "password1732174214265", + "visible": true, + "type": "string", + "enabled": true, + "constraintMessages": { + "pattern": "Enter valid password" + }, + "readOnly": false, + "pattern": "^(?=.*\\d.*\\d)[A-Za-z\\d!@]+$", + "label": { + "visible": true, + "value": "Password" + }, + "events": { + "custom:setProperty": [ + "$event.payload" + ] + }, + "properties": { + "fd:dor": { + "dorExclusion": false + }, + "fd:path": "/content/forms/af/testcheckboaf2/jcr:content/guideContainer/password" + }, + ":type": "forms-components-examples/components/form/password" }, + "password-format" : { "jcr:primaryType": "nt:unstructured", "sling:resourceType" : "core/fd/components/form/password/v1/password", diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml index fd92ff415e..359c182ba3 100644 --- a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml +++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/password/_cq_template.xml @@ -1,5 +1,4 @@ \ No newline at end of file + jcr:title="Password"/> \ No newline at end of file diff --git a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml index 0237cad9c1..5ea77a57d6 100644 --- a/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml +++ b/examples/ui.content/src/main/content/jcr_root/content/core-components-examples/library/adaptive-form/password/.content.xml @@ -115,78 +115,8 @@ placeholder="Enter valid password" tooltip="<p>This is a short description.</p>" tooltipVisible="true" - validationPattern="^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,20}$"/> + pattern="^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,20}$"/> - - - - - - - + diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js index 3e3ae98578..aa31facd66 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/replacehook.js @@ -40,7 +40,8 @@ 'plain-text': fieldTypes.NON_INPUT, 'title': fieldTypes.NON_INPUT, 'image': fieldTypes.NON_INPUT, - 'panel': fieldTypes.CONTAINER + 'panel': fieldTypes.CONTAINER, + 'password' : fieldTypes.TEXT } const preservedProperties = ['id', 'description', 'enabled', 'jcr:created', 'jcr:title', 'name', diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md index 05243a770b..43a319cc1a 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/README.md @@ -36,9 +36,18 @@ The following properties are written to JCR for this Form Password component and 2. `./hideTitle` - if set to `true`, the label of this field will be hidden 3. `./name` - defines the name of the field, which will be submitted with the form data 4. `./description` - defines a help message that can be rendered in the field as a hint for the user -5. `./required` - if set to `true`, this field will be marked as required, not allowing the form to be submitted until the field has a value -6. `./requiredMessage` - defines the message displayed as tooltip when submitting the form if the value is left empty -7. `./readOnly` - if set to `true`, the filed will be read only +5. `./dataRef` - defines bind reference with model +6. `./placeholder` - defines place holder for the field +7. `./unboundFormElement` - defines if the field is unbound +8. `./required` - if set to `true`, this field will be marked as required, not allowing the form to be submitted until the field has a value +9. `./requiredMessage` - defines the message displayed as tooltip when submitting the form if the value is left empty +10. `./readOnly` - if set to `true`, the filed will be read only +11. `./maxLength` - define maximum characters permitted +12. `./minLength` - define minimum characters permitted +13. `./maxLengthMessage` - define maximum characters of error message permitted +14. `./pattern` - define regular expression permitted +15. `./minLengthMessage` - define minimum characters of error message permitted +16. `./validatePictureClauseMessage` - define error message if wrong pattern is entered. ## Client Libraries The component provides a `core.forms.components.password.v1.runtime` client library category that contains the Javascript runtime for the component. @@ -57,22 +66,21 @@ BLOCK cmp-adaptiveform-password ELEMENT cmp-adaptiveform-password__shortdescription ELEMENT cmp-adaptiveform-password__longdescription ELEMENT cmp-adaptiveform-password__errormessage + ELEMENT cmp-adaptiveform-password__eyeicon + ELEMENT cmp-adaptiveform-password__input-wrapper ``` ### Note By placing the class names `cmp-adaptiveform-password__label` and `cmp-adaptiveform-password__questionmark` within the `cmp-adaptiveform-password__label-container` class, you create a logical grouping of the label and question mark elements. This approach simplifies the process of maintaining a consistent styling for both elements. ## Replace feature: -We support replace feature that allows replacing Reset Button component to any of the below components: +We support replace feature that allows replacing Password component to any of the below components: -* Button -* Date Picker * Email Input * Number Input -* Reset Button -* Submit Button * Telephone Input * Text Box +* Email Input ## JavaScript Data Attribute Bindings diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml index 786f295810..66bdc4d796 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/_cq_dialog/.content.xml @@ -93,25 +93,13 @@ sling:resourceType="fd/af/authoring/components/granite/form/fieldset" title="Validation Pattern"> - - - + name="./pattern"/> + jcr:title="Password"/> diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml index 27631c55e6..50764aff9f 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/.content.xml @@ -3,4 +3,4 @@ jcr:primaryType="cq:ClientLibraryFolder" allowProxy="{Boolean}true" categories="[core.forms.components.password.v1.runtime]" - dependencies="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime]"/> + dependencies="[core.forms.components.runtime.base]"/> diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js index 966dd5f42b..54d4b4ba2e 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/clientlibs/site/js/passwordview.js @@ -87,17 +87,19 @@ }); } - #togglePasswordType(){ - const widget = this.getWidget(); - if(widget.value){ - const widget = this.getWidget(); - if (widget.type === "password") { - widget.type = "text"; - } else { - widget.type = "password"; - } - } - } + #togglePasswordType(){ + const widget = this.getWidget(); + if(widget.value){ + const widget = this.getWidget(); + if (widget.type === "password") { + widget.type = "text"; + this.getEyeIcon().classList.add('open'); + } else { + widget.type = "password"; + this.getEyeIcon().classList.remove('open'); + } + } + } } FormView.Utils.setupField(({element, formContainer}) => { diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html index 21f798bd59..0ddf556261 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/password/v1/password/password.html @@ -48,7 +48,7 @@ placeholder="${password.placeHolder}" pattern="${password.validationPattern}" dir="auto" - aria-label="password" /> + aria-label="${password.label.visible != false ? '' : password.label.value}" />
diff --git a/ui.frontend/src/constants.js b/ui.frontend/src/constants.js index 7b6ad2a910..a74dc91e20 100644 --- a/ui.frontend/src/constants.js +++ b/ui.frontend/src/constants.js @@ -374,7 +374,7 @@ export const Constants = { * @memberof module:FormView~Constants * @namespace FIELD_TYPE */ - FIELD_TYPE: FIELD_TYPE + FIELD_TYPE: FIELD_TYPE, /** * Html input type text diff --git a/ui.tests/test-module/specs/password/password.authoring.spec.js b/ui.tests/test-module/specs/password/password.authoring.cy.js similarity index 97% rename from ui.tests/test-module/specs/password/password.authoring.spec.js rename to ui.tests/test-module/specs/password/password.authoring.cy.js index e35344b029..a6e4552e99 100644 --- a/ui.tests/test-module/specs/password/password.authoring.spec.js +++ b/ui.tests/test-module/specs/password/password.authoring.cy.js @@ -53,7 +53,7 @@ describe('Page - Authoring', function () { cy.get(".cmp-adaptiveform-password__minlength").invoke('css', 'display').should('equal', 'block'); cy.get(".cmp-adaptiveform-base__placeholder").parent('div').invoke('css', 'display').should('equal', 'block'); cy.get('.cmp-adaptiveform-password__editdialog').contains('Validation').click({force: true}).then(() => { - cy.get("[name='./validationPattern']").should('have.length', 1); + cy.get("[name='./pattern']").should('have.length', 1); cy.get("[name='./validatePictureClauseMessage']").should('have.length', 1); cy.get('.cq-dialog-cancel').click(); cy.deleteComponentByPath(passwordDrop); @@ -82,7 +82,7 @@ describe('Page - Authoring', function () { // Check If Dialog Options Are Visible cy.get(".cmp-adaptiveform-base__editdialogbasic [name='./name']") .should("exist") - .should("have.value", "password_copy_1"); + .should("have.value", "Password_copy_1"); cy.get("coral-dialog.is-open coral-dialog-footer button[variant='default']").click(); cy.deleteComponentByPath(passwordDrop); cy.deleteComponentByPath(passwordDrop + "_copy"); @@ -117,7 +117,7 @@ describe('Page - Authoring', function () { testPasswordBehaviour(passwordEditPathSelector, passwordDrop); }) - it.skip('pasted component should have unique name', function () { + it('pasted component should have unique name', function () { testCopyPasteComponent(passwordEditPathSelector, passwordEditPathSelectorCopy, passwordDrop); }) }) diff --git a/ui.tests/test-module/specs/password/password.runtime.spec.js b/ui.tests/test-module/specs/password/password.runtime.cy.js similarity index 94% rename from ui.tests/test-module/specs/password/password.runtime.spec.js rename to ui.tests/test-module/specs/password/password.runtime.cy.js index 236da69a6a..7163223cf1 100644 --- a/ui.tests/test-module/specs/password/password.runtime.spec.js +++ b/ui.tests/test-module/specs/password/password.runtime.cy.js @@ -158,5 +158,12 @@ describe("Form Runtime with Password", () => { }) }) + + it("should show required error message on entering wrong validation pattern of password", () =>{ + const [passwordbox11, passwordbox11FieldView] = Object.entries(formContainer._fields)[10]; + cy.get(`#${passwordbox11}`).find("input").clear().type(1).blur().then(x => { + cy.get(`#${passwordbox11}`).find(".cmp-adaptiveform-password__errormessage").should('have.text',"Please enter valid password") + }) + }) })