Skip to content

Commit

Permalink
FORMS-10078: resolved PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Gulshan Mishra committed Oct 9, 2023
1 parent 333d222 commit 0c63b77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
jcr:primaryType="nt:unstructured"
name="emailinput1"
jcr:title="Email Input 1"
pattern="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$"
pattern="^(([^<>()\\[\\]\\\\.,;:\\s@"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@"]+)*)|(".+"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$"
validatePictureClauseMessage="validation picture clause error message!"
sling:resourceType="forms-components-examples/components/form/emailinput"/>
<emailinput2
Expand Down
14 changes: 11 additions & 3 deletions ui.tests/test-module/specs/emailinput/emailinput.runtime.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,17 @@ describe("Form Runtime with Email Input", () => {

it(" Invalid email ID generates error message ", () => {
const [id, fieldView] = Object.entries(formContainer._fields)[0]
const input = "invalidEmail"
cy.get(`#${id}`).find("input").clear().type(input).blur().then(x => {
cy.get('.cmp-adaptiveform-emailinput__errormessage').should('exist');
const notAllowed = "invalidEmail"
cy.get(`#${id}`).find("input").clear().type(notAllowed).blur().then(x => {
cy.get('.cmp-adaptiveform-emailinput__errormessage').should('be.visible');
})
const invalidEmailPattern = "invalidEmail@domain"
cy.get(`#${id}`).find("input").clear().type(invalidEmailPattern).blur().then(x => {
cy.get('.cmp-adaptiveform-emailinput__errormessage').should('be.visible');
})
const validEmailPattern = "[email protected]"
cy.get(`#${id}`).find("input").clear().type(validEmailPattern).blur().then(x => {
cy.get('.cmp-adaptiveform-emailinput__errormessage').should('not.be.visible');
})
});

Expand Down

0 comments on commit 0c63b77

Please sign in to comment.