From 68f98cb458b0a1ea7dba3e3f5e38ae3ab706f56d Mon Sep 17 00:00:00 2001 From: faiz shabeeb <55506249+shabeeb-aot@users.noreply.github.com> Date: Fri, 18 Mar 2022 13:44:21 -0700 Subject: [PATCH] Document Delivery: Shared component#11408 (#357) * Document Delivery: Shared component#11408 * Document Delivery: Shared component#11408 * Document Delivery: Shared component#11408 * Document Delivery: Shared component#11408 * Document Delivery: Shared component#11408 --- package-lock.json | 2 +- package.json | 2 +- src/components/common/DocumentDelivery.vue | 19 +++++++++++-- .../Dissolution/DissolutionReviewConfirm.vue | 3 +- src/views/DissolutionFirm/DissolutionFirm.vue | 6 +++- .../IncorporationReviewConfirm.vue | 3 +- .../RegistrationReviewConfirm.vue | 3 +- tests/unit/DocumentDelivery.spec.ts | 28 ++++++++++++------- 8 files changed, 47 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 78c602e68..09182ba05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "business-create-ui", - "version": "3.4.10", + "version": "3.4.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7f68986fd..1b2768e84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-create-ui", - "version": "3.4.10", + "version": "3.4.11", "private": true, "appName": "Create UI", "sbcName": "SBC Common Components", diff --git a/src/components/common/DocumentDelivery.vue b/src/components/common/DocumentDelivery.vue index 2594f7f35..3194b5a5e 100644 --- a/src/components/common/DocumentDelivery.vue +++ b/src/components/common/DocumentDelivery.vue @@ -3,10 +3,10 @@ - + - {{registeredOfficeEmail || '(Not entered)'}} + {{contactValue || '(Not entered)'}} @@ -41,6 +41,15 @@ {{custodianEmail || '(Not entered)'}} + + + + + + + {{additionalValue || '(Not entered)'}} + + @@ -50,7 +59,8 @@ import { Component, Emit, Prop, Vue, Watch } from 'vue-property-decorator' @Component({}) export default class DocumentDelivery extends Vue { - @Prop({ default: null }) readonly registeredOfficeEmail: string + @Prop({ required: true }) readonly contactLabel: string + @Prop({ default: null }) readonly contactValue: string @Prop({ default: null }) readonly custodianEmail: string @Prop({ default: null }) readonly completingPartyEmail: string @Prop({ default: null }) readonly documentOptionalEmail: string @@ -59,6 +69,9 @@ export default class DocumentDelivery extends Vue { @Prop({ default: false }) readonly showCustodianEmail: boolean @Prop({ default: false }) readonly invalidSection: boolean + @Prop({ default: null }) readonly additionalLabel: string // for additon fields. + @Prop({ default: null }) readonly additionalValue: string + // Local properties private optionalEmail: string = '' diff --git a/src/views/Dissolution/DissolutionReviewConfirm.vue b/src/views/Dissolution/DissolutionReviewConfirm.vue index 488bf8c70..1d5fc6838 100644 --- a/src/views/Dissolution/DissolutionReviewConfirm.vue +++ b/src/views/Dissolution/DissolutionReviewConfirm.vue @@ -175,12 +175,13 @@ :editableCompletingParty="isRoleStaff" :showCustodianEmail="true" :invalidSection="isDocumentDeliveryInvalid" - :registeredOfficeEmail="getBusinessContact.email" + :contactValue="getBusinessContact.email" :custodianEmail="getDissolutionCustodianEmail" :completingPartyEmail="getUserEmail" :documentOptionalEmail="getDocumentDelivery.documentOptionalEmail" @update:optionalEmail="setDocumentOptionalEmail($event)" @valid="setDocumentOptionalEmailValidity($event)" + contactLabel="Registered Office" /> diff --git a/src/views/DissolutionFirm/DissolutionFirm.vue b/src/views/DissolutionFirm/DissolutionFirm.vue index 9d3e91eab..28b8962b9 100644 --- a/src/views/DissolutionFirm/DissolutionFirm.vue +++ b/src/views/DissolutionFirm/DissolutionFirm.vue @@ -27,18 +27,22 @@

+ + diff --git a/src/views/Incorporation/IncorporationReviewConfirm.vue b/src/views/Incorporation/IncorporationReviewConfirm.vue index 135eaeadd..96fd934c3 100644 --- a/src/views/Incorporation/IncorporationReviewConfirm.vue +++ b/src/views/Incorporation/IncorporationReviewConfirm.vue @@ -55,8 +55,9 @@ diff --git a/src/views/Registration/RegistrationReviewConfirm.vue b/src/views/Registration/RegistrationReviewConfirm.vue index 2fb722caa..fbb64e672 100644 --- a/src/views/Registration/RegistrationReviewConfirm.vue +++ b/src/views/Registration/RegistrationReviewConfirm.vue @@ -37,10 +37,11 @@ class="py-8 px-6" :class="{ 'invalid-section': isDocumentDeliveryInvalid }" :editableCompletingParty="isRoleStaff || isSbcStaff" - :registeredOfficeEmail="getBusinessContact.email" + :contactValue="getBusinessContact.email" :completingPartyEmail="getUserEmail" :invalidSection="isDocumentDeliveryInvalid" @valid="setDocumentOptionalEmailValidity($event)" + contactLabel="Registered Office" /> diff --git a/tests/unit/DocumentDelivery.spec.ts b/tests/unit/DocumentDelivery.spec.ts index a56de3a20..b9541dbc6 100644 --- a/tests/unit/DocumentDelivery.spec.ts +++ b/tests/unit/DocumentDelivery.spec.ts @@ -43,20 +43,25 @@ for (const mock of documentDeliveryCases) { let wrapper: any it('renders the component properly', () => { - wrapper = shallowWrapperFactory(DocumentDelivery) + wrapper = shallowWrapperFactory(DocumentDelivery, { + contactLabel: 'Registered Office' + }) expect(wrapper.find('#document-delivery').exists()).toBe(true) }) it('displays email labels', () => { - wrapper = shallowWrapperFactory(DocumentDelivery) + wrapper = shallowWrapperFactory(DocumentDelivery, { + contactLabel: 'Registered Office' + }) expect(wrapper.findAll('label').at(0).text()).toBe('Registered Office') expect(wrapper.findAll('label').at(1).text()).toBe('Completing Party') }) it('displays email computed values', () => { wrapper = shallowWrapperFactory(DocumentDelivery, { - registeredOfficeEmail: mock.businessContact.email, - completingPartyEmail: mock.tombstone.userEmail + contactValue: mock.businessContact.email, + completingPartyEmail: mock.tombstone.userEmail, + contactLabel: 'Registered Office' }) expect(wrapper.find('#completing-party-email').text()).toBe(mock.tombstone.userEmail) expect(wrapper.find('#office-email').text()).toBe(mock.businessContact.email) @@ -67,8 +72,9 @@ for (const mock of documentDeliveryCases) { mock.businessContact.email = '' wrapper = shallowWrapperFactory(DocumentDelivery, { - registeredOfficeEmail: mock.businessContact.email, - completingPartyEmail: mock.tombstone.userEmail + contactValue: mock.businessContact.email, + completingPartyEmail: mock.tombstone.userEmail, + contactLabel: 'Registered Office' }) expect(wrapper.find('#completing-party-email').text()).toBe('(Not entered)') expect(wrapper.find('#office-email').text()).toBe('(Not entered)') @@ -76,18 +82,20 @@ for (const mock of documentDeliveryCases) { it('displays optionalEmail', () => { wrapper = shallowWrapperFactory(DocumentDelivery, { - registeredOfficeEmail: mock.businessContact.email, + contactValue: mock.businessContact.email, completingPartyEmail: mock.tombstone.userEmail, - editableCompletingParty: mock.optionalEmail + editableCompletingParty: mock.optionalEmail, + contactLabel: 'Registered Office' }) expect(wrapper.find('#optionalEmail').exists()).toBe(mock.optionalEmail) }) it('displays showCustodianEmail', () => { wrapper = shallowWrapperFactory(DocumentDelivery, { - registeredOfficeEmail: mock.businessContact.email, + contactValue: mock.businessContact.email, completingPartyEmail: mock.tombstone.userEmail, - showCustodianEmail: mock.custodianEmail + showCustodianEmail: mock.custodianEmail, + contactLabel: 'Registered Office' }) expect(wrapper.find('#custodian-email').exists()).toBe(mock.custodianEmail) })