-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI: Tax Number and Tax Residency (#48)
* add TaxNumber and TaxResidency component to btr-common-component * add TaxNumber and TaxResidency to the main app * update Tax Number component and add tests * fix bugs in tax number * Tax Number component update - check the radio button when the input box is clicked * small tweak for tax number component --------- Co-authored-by: Patrick Wang <[email protected]>
- Loading branch information
1 parent
c778a7c
commit 42ee4b5
Showing
12 changed files
with
409 additions
and
34 deletions.
There are no files selected for viewing
27 changes: 17 additions & 10 deletions
27
btr-web/btr-common-components/cypress/e2e/pages/examples/form/full-name.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,65 @@ | ||
describe('forms -> preferred name -> validate that the preferred name component work inside example form', () => { | ||
let en: any | ||
|
||
beforeEach(() => { | ||
// load the English version of the language file | ||
cy.readFile('lang/en.json').then((json) => { | ||
en = json | ||
}) | ||
|
||
// navigate to index page and check footer and header exist | ||
cy.visit('/examples/form') | ||
cy.wait(1000) | ||
}) | ||
|
||
it('test the validation rule for the maximum name length', () => { | ||
cy.on('uncaught:exception', (err) => { | ||
expect(err.message).to.include('The legal name must not exceed 150 characters') | ||
expect(err.message).to.include(en.errors.validation.fullName.maxLengthExceeded) | ||
return false | ||
}) | ||
|
||
const invalidLongName = 'a'.repeat(151) | ||
const validLongName = ' ' + 'a'.repeat(150) + ' ' | ||
|
||
cy.get('#testFullName').type(invalidLongName).blur() | ||
cy.contains('The legal name must not exceed 150 characters').should('exist') | ||
cy.contains(en.errors.validation.fullName.maxLengthExceeded).should('exist') | ||
|
||
cy.get('#testFullName').clear().type(validLongName).blur() | ||
cy.contains('The legal name must not exceed 150 characters').should('not.exist') | ||
cy.contains(en.errors.validation.fullName.maxLengthExceeded).should('not.exist') | ||
}) | ||
|
||
it('test the validation rule for the minimum name length', () => { | ||
cy.on('uncaught:exception', (err) => { | ||
expect(err.message).to.include('The legal name should contain at least one character') | ||
expect(err.message).to.include(en.errors.validation.fullName.empty) | ||
return false | ||
}) | ||
|
||
const singleCharacter = 'a' | ||
cy.get('#testFullName').type(singleCharacter).blur() | ||
cy.contains('The legal name should contain at least one character').should('not.exist') | ||
cy.contains(en.errors.validation.fullName.empty).should('not.exist') | ||
|
||
cy.get('#testFullName').clear().blur() | ||
cy.contains('The legal name should contain at least one character').should('exist') | ||
cy.contains(en.errors.validation.fullName.empty).should('exist') | ||
}) | ||
|
||
it('test the validation rule for special character', () => { | ||
cy.on('uncaught:exception', (err) => { | ||
expect(err.message).to.include('The legal name should not contain special character') | ||
expect(err.message).to.include(en.errors.validation.fullName.specialCharacter) | ||
return false | ||
}) | ||
|
||
const invalidName = 'first - last' | ||
const validName = 'first last' | ||
|
||
cy.get('#testFullName').type(invalidName).blur() | ||
cy.contains('The legal name should not contain special character').should('exist') | ||
cy.contains(en.errors.validation.fullName.specialCharacter).should('exist') | ||
|
||
cy.get('#testFullName').clear().type(validName).blur() | ||
cy.contains('The legal name should not contain special character').should('not.exist') | ||
cy.contains(en.errors.validation.fullName.specialCharacter).should('not.exist') | ||
}) | ||
|
||
it('the full name field should accept UTF-8 characters', () => { | ||
cy.contains('Full Legal Name:') | ||
cy.contains(en.labels.fullName) | ||
const email = '[email protected]' | ||
cy.get('#testEmail').type(email) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.