diff --git a/package-lock.json b/package-lock.json index da750d52..1a4d44a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-create-ui", - "version": "5.12.9", + "version": "5.12.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-create-ui", - "version": "5.12.9", + "version": "5.12.10", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/approval-type": "1.1.3", diff --git a/package.json b/package.json index 90a7cddd..3896072c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-create-ui", - "version": "5.12.9", + "version": "5.12.10", "private": true, "appName": "Create UI", "sbcName": "SBC Common Components", diff --git a/src/components/ContinuationIn/AuthorizationInformation.vue b/src/components/ContinuationIn/AuthorizationInformation.vue index 5914b527..345f21ae 100644 --- a/src/components/ContinuationIn/AuthorizationInformation.vue +++ b/src/components/ContinuationIn/AuthorizationInformation.vue @@ -129,7 +129,10 @@ - + - + - - - - - - - - - - - @@ -317,7 +293,6 @@ import { Rules } from '@/rules' import ExtraproBusinessLookup from './ExtraproBusinessLookup.vue' import MessageBox from '@/components/common/MessageBox.vue' import RegistriesContactInfo from '@/components/common/RegistriesContactInfo.vue' -import UploadAffidavit from './UploadAffidavit.vue' import { DatePicker as DatePickerShared } from '@bcrs-shared-components/date-picker' @Component({ @@ -327,8 +302,7 @@ import { DatePicker as DatePickerShared } from '@bcrs-shared-components/date-pic GenericErrorDialog, Jurisdiction, MessageBox, - RegistriesContactInfo, - UploadAffidavit + RegistriesContactInfo }, directives: { mask @@ -346,7 +320,6 @@ export default class ExtraproRegistration extends Mixins(DateMixin) { @Getter(useStore) getCurrentDate!: string @Getter(useStore) getExistingBusinessInfo!: ExistingBusinessInfoIF @Getter(useStore) getShowErrors!: boolean - @Getter(useStore) isContinuationInAffidavitRequired!: boolean @Action(useStore) setExistingBusinessInfo!: (x: ExistingBusinessInfoIF) => void @Action(useStore) setHaveChanges!: (x: boolean) => void @@ -355,7 +328,6 @@ export default class ExtraproRegistration extends Mixins(DateMixin) { active = false business = {} as ExistingBusinessInfoIF formValid = false - affidavitValid = false uploadMemorandumDoc = null as File uploadMemorandumDocKey = null as string errorDialog = false @@ -537,7 +509,6 @@ export default class ExtraproRegistration extends Mixins(DateMixin) { /** Emits form validity. */ @Watch('isBusinessActive') @Watch('business', { deep: true }) - @Watch('affidavitValid') @Watch('formValid') @Watch('getShowErrors') @Emit('valid') @@ -548,15 +519,12 @@ export default class ExtraproRegistration extends Mixins(DateMixin) { // this component is valid if we have an active business // and we have the home jurisdiction (custom component) // and we have the home incorporation date (custom component) - // and we have the affidavit file, if required (custom component) // and the other form (Vuetify) components are valid - // show tick mark only when user visits Review Page return ( this.getShowErrors && this.isBusinessActive && !!this.business.previousJurisdiction && !!this.business.prevIncorporationDate && - (!this.isContinuationInAffidavitRequired || this.affidavitValid) && this.formValid ) } diff --git a/src/components/ContinuationIn/ManualBusinessInfo.vue b/src/components/ContinuationIn/ManualBusinessInfo.vue index 3d597f2c..ebcd4f0f 100644 --- a/src/components/ContinuationIn/ManualBusinessInfo.vue +++ b/src/components/ContinuationIn/ManualBusinessInfo.vue @@ -139,30 +139,6 @@ /> - - - - - - - - - - - @@ -183,14 +159,12 @@ import { DatePicker as DatePickerShared } from '@bcrs-shared-components/date-pic import { JurisdictionLocation } from '@bcrs-shared-components/enums' import { CountriesProvincesMixin } from '@/mixins/' import { FormIF } from '@bcrs-shared-components/interfaces' -import UploadAffidavit from './UploadAffidavit.vue' @Component({ components: { DatePickerShared, Jurisdiction, - MessageBox, - UploadAffidavit + MessageBox }, directives: { mask @@ -208,7 +182,6 @@ export default class ManualBusinessInfo extends Mixins(CountriesProvincesMixin, @Getter(useStore) getCurrentDate!: string @Getter(useStore) getExistingBusinessInfo!: ExistingBusinessInfoIF @Getter(useStore) getShowErrors!: boolean - @Getter(useStore) isContinuationInAffidavitRequired!: boolean @Action(useStore) setExistingBusinessInfo!: (x: ExistingBusinessInfoIF) => void @Action(useStore) setHaveChanges!: (x: boolean) => void @@ -217,7 +190,6 @@ export default class ManualBusinessInfo extends Mixins(CountriesProvincesMixin, active = false business = {} as ExistingBusinessInfoIF formValid = false - affidavitValid = false readonly identifyingNumberRules: Array = [ (v) => !!v?.trim() || 'Identifying Number is required', @@ -309,7 +281,6 @@ export default class ManualBusinessInfo extends Mixins(CountriesProvincesMixin, /** Emits form validity. */ @Watch('business', { deep: true }) @Watch('formValid') - @Watch('affidavitValid') @Watch('getShowErrors') @Emit('valid') private onComponentValid (): boolean { @@ -318,14 +289,11 @@ export default class ManualBusinessInfo extends Mixins(CountriesProvincesMixin, // this form is valid if we have the previous jurisdiction (custom component) // and we have the incorporation date (custom component) - // and we have the affidavit file, if required (custom component) // and the other form (Vuetify) components are valid - // show tick mark only when user visits Review Page return ( this.getShowErrors && !!this.business.previousJurisdiction && !!this.business.prevIncorporationDate && - (!this.isContinuationInAffidavitRequired || this.affidavitValid) && this.formValid ) } diff --git a/src/components/ContinuationIn/UnlimitedLiabilityCorporationInformation.vue b/src/components/ContinuationIn/UnlimitedLiabilityCorporationInformation.vue new file mode 100644 index 00000000..7bfc5c98 --- /dev/null +++ b/src/components/ContinuationIn/UnlimitedLiabilityCorporationInformation.vue @@ -0,0 +1,259 @@ + + + + + diff --git a/src/components/ContinuationIn/UploadAffidavit.vue b/src/components/ContinuationIn/UploadAffidavit.vue deleted file mode 100644 index 801bf9ff..00000000 --- a/src/components/ContinuationIn/UploadAffidavit.vue +++ /dev/null @@ -1,224 +0,0 @@ - - - - - diff --git a/src/components/common/RegAddEditOrgPerson.vue b/src/components/common/RegAddEditOrgPerson.vue index c790f419..d5a2598c 100644 --- a/src/components/common/RegAddEditOrgPerson.vue +++ b/src/components/common/RegAddEditOrgPerson.vue @@ -125,7 +125,7 @@ @@ -101,30 +144,46 @@ import { Component, Mixins, Watch } from 'vue-property-decorator' import { Getter, Action } from 'pinia-class' import { useStore } from '@/store/store' import { CommonMixin, NameRequestMixin } from '@/mixins' +import { ExistingBusinessInfoIF } from '@/interfaces' import { ContactPointIF } from '@bcrs-shared-components/interfaces' +import { ExpandableHelp } from '@bcrs-shared-components/expandable-help' +import { JurisdictionLocation } from '@bcrs-shared-components/enums/' import AuthorizationProof from '@/components/ContinuationIn/AuthorizationProof.vue' import BusinessContactInfo from '@/components/common/BusinessContactInfo.vue' import ExtraproRegistration from '@/components/ContinuationIn/ExtraproRegistration.vue' import ManualBusinessInfo from '@/components/ContinuationIn/ManualBusinessInfo.vue' import NameRequestInfo from '@/components/common/NameRequestInfo.vue' import NameTranslations from '@/components/common/NameTranslations.vue' +import UnlimitedLiabilityCorporationInformation + from '@/components/ContinuationIn/UnlimitedLiabilityCorporationInformation.vue' +import UnlimitedLiabilityCorporationHelp from '@/components/ContinuationIn/UnlimitedLiabilityCorporationHelp.vue' @Component({ components: { AuthorizationProof, BusinessContactInfo, + ExpandableHelp, ExtraproRegistration, ManualBusinessInfo, NameRequestInfo, - NameTranslations + NameTranslations, + UnlimitedLiabilityCorporationHelp, + UnlimitedLiabilityCorporationInformation } }) export default class ContinuationInAuthorization extends Mixins(CommonMixin, NameRequestMixin) { + // Refs + $refs!: { + ulcInformation: UnlimitedLiabilityCorporationInformation + } + @Getter(useStore) getBusinessContact!: ContactPointIF + @Getter(useStore) getExistingBusinessInfo!: ExistingBusinessInfoIF @Getter(useStore) getNameRequestNumber!: string @Getter(useStore) getNameTranslationsValid!: boolean @Getter(useStore) getShowErrors!: boolean @Getter(useStore) getValidateSteps!: boolean + @Getter(useStore) isEntityUlcContinueIn!: boolean @Getter(useStore) isFilingValid!: boolean @Action(useStore) setBusinessContact!: (x: ContactPointIF) => void @@ -140,13 +199,15 @@ export default class ContinuationInAuthorization extends Mixins(CommonMixin, Nam extraproRegistrationValid = false businessContactInfoValid = false authorizationProofValid = false + ulcInformationValid = false /** Array of valid components. Must match validFlags below. */ readonly validComponents = [ - 'name-header', + 'name-section', 'existing-business-information', 'contact-information', - 'proof-of-authorization' + 'proof-of-authorization', + 'ulc-information-section' ] /** Object of valid flags. Must match validComponents above. */ @@ -155,10 +216,24 @@ export default class ContinuationInAuthorization extends Mixins(CommonMixin, Nam validNameSection: this.getNameTranslationsValid, existingBusinessInformationValid: this.existingBusinessInformationValid, contactInformationValid: this.businessContactInfoValid, - authorizationProofValid: this.authorizationProofValid + authorizationProofValid: this.authorizationProofValid, + ulcInformationValid: this.ulcInformationValid } } + /** + * Whether additional ULC information is required. + * Is true if the business is a Continued In ULC from Alberta. + */ + get isUlcInfoRequired (): boolean { + const previousJurisdiction = this.getExistingBusinessInfo?.previousJurisdiction + return ( + this.isEntityUlcContinueIn && + (previousJurisdiction?.country === JurisdictionLocation.CA) && + (previousJurisdiction?.region === 'AB') + ) + } + /** Whether the Existing Business Information section is valid. */ get existingBusinessInformationValid (): boolean { return (this.extraproRegistrationValid || this.manualBusinessInfoValid) @@ -175,17 +250,31 @@ export default class ContinuationInAuthorization extends Mixins(CommonMixin, Nam }) } - /** Watch all components on this page and set validity in store accordingly. */ + /** When ULC Info is no longer required, remove existing file info. */ + @Watch('isUlcInfoRequired') + private onUlcInfoRequiredChanged (val: boolean): void { + if (!val) { + this.$refs.ulcInformation.onRemoveClicked() + } + } + + /** + * Watch all components on this page and set validity in the store accordingly. + * Note: Only need 1 immediate watcher for initial update. + */ @Watch('getNameTranslationsValid', { immediate: true }) - @Watch('existingBusinessInformationValid', { immediate: true }) - @Watch('businessContactInfoValid', { immediate: true }) - @Watch('authorizationProofValid', { immediate: true }) + @Watch('existingBusinessInformationValid') + @Watch('businessContactInfoValid') + @Watch('authorizationProofValid') + @Watch('isUlcInfoRequired') + @Watch('ulcInformationValid') private onComponentValidityChanged () { this.setContinuationAuthorizationPageValid( this.getNameTranslationsValid && this.existingBusinessInformationValid && this.businessContactInfoValid && - this.authorizationProofValid + this.authorizationProofValid && + (!this.isUlcInfoRequired || this.ulcInformationValid) ) } diff --git a/tests/unit/AuthorizationInformation.spec.ts b/tests/unit/AuthorizationInformation.spec.ts index 95d510ae..32de1abb 100644 --- a/tests/unit/AuthorizationInformation.spec.ts +++ b/tests/unit/AuthorizationInformation.spec.ts @@ -7,13 +7,11 @@ describe('Authorization Information component', () => { const wrapper = wrapperFactory( AuthorizationInformation, null, - null, + { continuationIn: { existingBusinessInfo: { affidavitFile: {} } } }, null, null, // declare computed property to override computed property: - { - isExpro: () => true - } + { isExpro: () => true } ) await Vue.nextTick() diff --git a/tests/unit/ContinuationInAuthorization.spec.ts b/tests/unit/ContinuationInAuthorization.spec.ts index be117f94..b5ba918a 100644 --- a/tests/unit/ContinuationInAuthorization.spec.ts +++ b/tests/unit/ContinuationInAuthorization.spec.ts @@ -6,10 +6,20 @@ import BusinessContactInfo from '@/components/common/BusinessContactInfo.vue' import AuthorizationProof from '@/components/ContinuationIn/AuthorizationProof.vue' import NameRequestInfo from '@/components/common/NameRequestInfo.vue' import NameTranslations from '@/components/common/NameTranslations.vue' +import { ExpandableHelp } from '@bcrs-shared-components/expandable-help' +import UnlimitedLiabilityCorporationInformation + from '@/components/ContinuationIn/UnlimitedLiabilityCorporationInformation.vue' describe('Continuation In Authorization component', () => { it('renders the component correctly', async () => { - const wrapper = wrapperFactory(ContinuationInAuthorization) + const wrapper = wrapperFactory( + ContinuationInAuthorization, + null, + null, + null, + null, + { isUlcInfoRequired: () => true } + ) await Vue.nextTick() // verify main component exists @@ -41,6 +51,13 @@ describe('Continuation In Authorization component', () => { expect(fourthSection.find('header p').text()).toContain('You must provide proof') expect(fourthSection.findComponent(AuthorizationProof).exists()).toBe(true) + const fifthSection = wrapper.findAll('section').at(4) + expect(fifthSection.find('header').exists()).toBe(true) + expect(fifthSection.find('header h2').text()).toBe('Unlimited Liability Corporation Information') + expect(fifthSection.find('header p').text()).toContain('Additional information is') + expect(fifthSection.findComponent(ExpandableHelp).exists()).toBe(true) + expect(fifthSection.findComponent(UnlimitedLiabilityCorporationInformation).exists()).toBe(true) + wrapper.destroy() }) }) diff --git a/tests/unit/ContinuationInUploadAffidavit.spec.ts b/tests/unit/ContinuationInUploadAffidavit.spec.ts deleted file mode 100644 index 7df6403e..00000000 --- a/tests/unit/ContinuationInUploadAffidavit.spec.ts +++ /dev/null @@ -1,54 +0,0 @@ -import Vue from 'vue' -import { shallowMount } from '@vue/test-utils' -import UploadAffidavit from '@/components/ContinuationIn/UploadAffidavit.vue' -import FileUploadPreview from '@/components/common/FileUploadPreview.vue' -import { ExpandableHelp } from '@bcrs-shared-components/expandable-help' -import { ExistingBusinessInfoIF } from '@/interfaces' - -// Create a mock business object -const businessMock: ExistingBusinessInfoIF = { - affidavitFile: null, - affidavitFileKey: null, - affidavitFileName: null, - previousJurisdiction: { - country: 'CA', - region: 'AB' - }, - prevIncorporationNumber: '', - prevIncorporationDate: '', - prevBusinessName: '', - mode: 'EXPRO' -} - -describe('Upload Affidavit component', () => { - it('renders the component correctly', async () => { - const wrapper = shallowMount(UploadAffidavit, { - propsData: { - business: businessMock - }, - stubs: { - FileUploadPreview: true - } - }) - - await Vue.nextTick() - - // Verify that main component exists - expect(wrapper.findComponent(UploadAffidavit).exists()).toBe(true) - - // Verify that text content is rendered correctly - expect(wrapper.text()).toContain('There is additional information required by the Registrar') - expect(wrapper.text()).toContain('for an unlimited liability corporation from Alberta.') - - expect(wrapper.find('ul').text()).toContain('Use a white background and a legible font') - expect(wrapper.find('ul').text()).toContain('PDF file type (maximum 30 MB file size)') - - // Verify that FileUploadPreview component is rendered - expect(wrapper.findComponent(FileUploadPreview).exists()).toBe(true) - - // Verify that ExpandableHelp component is rendered - expect(wrapper.findComponent(ExpandableHelp).exists()).toBe(true) - - wrapper.destroy() - }) -}) diff --git a/tests/unit/ExtraproRegistration.spec.ts b/tests/unit/ExtraproRegistration.spec.ts index 5c3e48ab..74db748a 100644 --- a/tests/unit/ExtraproRegistration.spec.ts +++ b/tests/unit/ExtraproRegistration.spec.ts @@ -1,14 +1,6 @@ import Vue from 'vue' -import { createPinia, setActivePinia } from 'pinia' -import { useStore } from '@/store/store' import { wrapperFactory } from '../vitest-wrapper-factory' -import { ExistingBusinessInfoIF } from '@/interfaces' -import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module' import ExtraproRegistration from '@/components/ContinuationIn/ExtraproRegistration.vue' -import UploadAffidavit from '@/components/ContinuationIn/UploadAffidavit.vue' - -setActivePinia(createPinia()) -const store = useStore() describe('Extrapro Registration component', () => { it('renders the component correctly', async () => { @@ -21,31 +13,4 @@ describe('Extrapro Registration component', () => { wrapper.destroy() }) - - it('renders the UploadAffidavit component correctly', async () => { - // set some store values - store.stateModel.continuationIn.existingBusinessInfo = { - affidavitFile: null, - affidavitFileKey: null, - affidavitFileName: null, - previousJurisdiction: { - country: 'CA', - region: 'AB' - }, - prevIncorporationNumber: '', - prevIncorporationDate: '', - prevBusinessName: '', - mode: 'EXPRO', - status: 'ACTIVE' - } as ExistingBusinessInfoIF - store.stateModel.entityType = CorpTypeCd.ULC_CONTINUE_IN - - const wrapper = wrapperFactory(ExtraproRegistration) - await Vue.nextTick() - - // Verify the Upload Affidavit component was rendered - expect(wrapper.findComponent(UploadAffidavit).exists()).toBe(true) - - wrapper.destroy() - }) }) diff --git a/tests/unit/ManualBusinessInfo.spec.ts b/tests/unit/ManualBusinessInfo.spec.ts index ba81624b..cade0e28 100644 --- a/tests/unit/ManualBusinessInfo.spec.ts +++ b/tests/unit/ManualBusinessInfo.spec.ts @@ -3,9 +3,7 @@ import { createPinia, setActivePinia } from 'pinia' import { useStore } from '@/store/store' import { wrapperFactory } from '../vitest-wrapper-factory' import { ExistingBusinessInfoIF } from '@/interfaces' -import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module' import ManualBusinessInfo from '@/components/ContinuationIn/ManualBusinessInfo.vue' -import UploadAffidavit from '@/components/ContinuationIn/UploadAffidavit.vue' setActivePinia(createPinia()) const store = useStore() @@ -22,32 +20,6 @@ describe('Manual Business Info component', () => { wrapper.destroy() }) - it('renders the UploadAffidavit component correctly', async () => { - // set some store values - store.stateModel.continuationIn.existingBusinessInfo = { - affidavitFile: null, - affidavitFileKey: null, - affidavitFileName: null, - previousJurisdiction: { - country: 'CA', - region: 'AB' - }, - prevIncorporationNumber: '', - prevIncorporationDate: '', - prevBusinessName: '', - mode: 'MANUAL' - } as ExistingBusinessInfoIF - store.stateModel.entityType = CorpTypeCd.ULC_CONTINUE_IN - - const wrapper = wrapperFactory(ManualBusinessInfo) - await Vue.nextTick() - - // Verify the Upload Affidavit component was rendered - expect(wrapper.findComponent(UploadAffidavit).exists()).toBe(true) - - wrapper.destroy() - }) - it('displays initial jurisdiction (Federal) value correctly', async () => { // set some store values store.stateModel.continuationIn.existingBusinessInfo = { diff --git a/tests/unit/UnlimitedLiabilityCorporationInformation.spec.ts b/tests/unit/UnlimitedLiabilityCorporationInformation.spec.ts new file mode 100644 index 00000000..afc31dd7 --- /dev/null +++ b/tests/unit/UnlimitedLiabilityCorporationInformation.spec.ts @@ -0,0 +1,73 @@ +import Vue from 'vue' +import { createPinia, setActivePinia } from 'pinia' +import { useStore } from '@/store/store' +import { wrapperFactory } from '../vitest-wrapper-factory' +import { ExistingBusinessInfoIF } from '@/interfaces' +import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module' +import UnlimitedLiabilityCorporationInformation + from '@/components/ContinuationIn/UnlimitedLiabilityCorporationInformation.vue' + +setActivePinia(createPinia()) +const store = useStore() + +describe('Unlimited Liability Corporation Information component', () => { + it('renders the component correctly with no file', async () => { + // set some store values + store.stateModel.continuationIn.existingBusinessInfo = {} as ExistingBusinessInfoIF + store.stateModel.entityType = CorpTypeCd.ULC_CONTINUE_IN + + const wrapper = wrapperFactory(UnlimitedLiabilityCorporationInformation) + await Vue.nextTick() + + // verify component exists + expect(wrapper.findComponent(UnlimitedLiabilityCorporationInformation).exists()).toBe(true) + expect(wrapper.find('#unlimited-liability-corporation-information').exists()).toBe(true) + + // verify initial validity + const valid = wrapper.emitted().valid + expect(valid[0][0]).toBe(false) + + // verify misc content + expect(wrapper.find('label').text()).toBe('Upload File') + expect(wrapper.find('p').text()).toContain('You are required to provide') + expect(wrapper.find('ul').text()).toContain('Use a white background') + expect(wrapper.find('ul').text()).toContain('PDF file type') + expect(wrapper.find('#add-affidavit-button').text()).toBe('Add a Document') + expect(wrapper.find('#add-affidavit-button').attributes('disabled')).toBeUndefined() + expect(wrapper.find('.document-details').exists()).toBe(false) + expect(wrapper.find('.remove-document-button').exists()).toBe(false) + expect(wrapper.find('.info-text').text()).toContain('Uploaded files will be') + + wrapper.destroy() + }) + + it('renders the component correctly with existing file', async () => { + // set some store values + store.stateModel.continuationIn.existingBusinessInfo = { + affidavitFile: { name: 'test.pdf', size: 123456 } as File, + affidavitFileKey: 'abc-123', + affidavitFileName: 'test.pdf' + } as ExistingBusinessInfoIF + store.stateModel.entityType = CorpTypeCd.ULC_CONTINUE_IN + + const wrapper = wrapperFactory(UnlimitedLiabilityCorporationInformation) + await Vue.nextTick() + + // verify component exists + expect(wrapper.findComponent(UnlimitedLiabilityCorporationInformation).exists()).toBe(true) + expect(wrapper.find('#unlimited-liability-corporation-information').exists()).toBe(true) + + // verify initial validity + const valid = wrapper.emitted().valid + expect(valid[0][0]).toBe(true) + + // verify misc content + expect(wrapper.find('#add-affidavit-button').attributes('disabled')).toBe('disabled') + expect(wrapper.find('.document-details').exists()).toBe(true) + expect(wrapper.find('.document-details').text()).toBe('test.pdf (121 KB)') + expect(wrapper.find('.remove-document-button').exists()).toBe(true) + expect(wrapper.find('.remove-document-button').text()).toBe('Remove') + + wrapper.destroy() + }) +})