Skip to content

Commit

Permalink
Document Delivery: Shared component#11408 (#357)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
shabeeb-aot authored Mar 18, 2022
1 parent bcecbe8 commit 68f98cb
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
19 changes: 16 additions & 3 deletions src/components/common/DocumentDelivery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<!-- Registered Office -->
<v-row no-gutters>
<v-col cols="12" sm="3" class="pr-4">
<label class="title-label">Registered Office</label>
<label class="title-label">{{contactLabel}}</label>
</v-col>
<v-col cols="12" sm="9">
<span id="office-email">{{registeredOfficeEmail || '(Not entered)'}}</span>
<span id="office-email">{{contactValue || '(Not entered)'}}</span>
</v-col>
</v-row>

Expand Down Expand Up @@ -41,6 +41,15 @@
<span id="custodian-email">{{custodianEmail || '(Not entered)'}}</span>
</v-col>
</v-row>

<v-row no-gutters v-if="additionalLabel" class="pt-3">
<v-col cols="12" sm="3" class="pr-4">
<label class="title-label">{{additionalLabel}}</label>
</v-col>
<v-col cols="12" sm="9">
<span id="additonal-email">{{additionalValue || '(Not entered)'}}</span>
</v-col>
</v-row>
</div>
</template>

Expand All @@ -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
Expand All @@ -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 = ''
Expand Down
3 changes: 2 additions & 1 deletion src/views/Dissolution/DissolutionReviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
</v-card>
</section>
Expand Down
6 changes: 5 additions & 1 deletion src/views/DissolutionFirm/DissolutionFirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@
</p>
</header>
<v-card flat class="mt-6">

<DocumentDelivery
:class="{ 'invalid-section': isDocumentDeliveryInvalid }"
:editableCompletingParty="isRoleStaff"
:showCustodianEmail="false"
:invalidSection="isDocumentDeliveryInvalid"
:registeredOfficeEmail="getBusinessContact.email"
:contactValue="getBusinessContact.email"
:custodianEmail="getDissolutionCustodianEmail"
:completingPartyEmail="getUserEmail"
:documentOptionalEmail="getDocumentDelivery.documentOptionalEmail"
@update:optionalEmail="setDocumentOptionalEmail($event)"
@valid="setDocumentOptionalEmailValidity($event)"
additionalLabel="partners"
contactLabel="Business Contact"
/>
<!-- TODO change: additionalEmail & additionalLabel are sample data-->
</v-card>
</section>

Expand Down
3 changes: 2 additions & 1 deletion src/views/Incorporation/IncorporationReviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@
<v-card flat class="mt-6">
<DocumentDelivery
class="py-8 px-6"
:registeredOfficeEmail="getBusinessContact.email"
:contactValue="getBusinessContact.email"
:completingPartyEmail="getUserEmail"
contactLabel="Registered Office"
/>
</v-card>
</section>
Expand Down
3 changes: 2 additions & 1 deletion src/views/Registration/RegistrationReviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
</v-card>
</section>
Expand Down
28 changes: 18 additions & 10 deletions tests/unit/DocumentDelivery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -67,27 +72,30 @@ 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)')
})

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)
})
Expand Down

0 comments on commit 68f98cb

Please sign in to comment.