Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20947 - Fix limited restoration to full filing saves or resumes with company Name change #606

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 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-edit-ui",
"version": "4.11.12",
"version": "4.11.13",
"private": true,
"appName": "Edit UI",
"sbcName": "SBC Common Components",
Expand Down
27 changes: 23 additions & 4 deletions src/components/common/YourCompany/EntityName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export default class EntityName extends Mixins(CommonMixin, NameRequestMixin) {
@Getter(useStore) isFirmChangeFiling!: boolean
@Getter(useStore) isFirmConversionFiling!: boolean
@Getter(useStore) isLimitedRestorationExtension!: boolean
@Getter(useStore) isLimitedRestorationToFull!: boolean
@Getter(useStore) isNumberedCompany!: boolean
@Getter(useStore) isSpecialResolutionFiling!: boolean
@Getter(useStore) isNameChangedByType!: boolean
Expand Down Expand Up @@ -321,7 +322,9 @@ export default class EntityName extends Mixins(CommonMixin, NameRequestMixin) {
this.hasCompanyNameChanged ||
(
this.hasBusinessNameChanged &&
(this.isAlterationFiling || this.isFirmChangeFiling || this.isSpecialResolutionFiling)
(this.isAlterationFiling || this.isFirmChangeFiling || this.isSpecialResolutionFiling ||
this.isLimitedRestorationToFull
)
)
)
}
Expand All @@ -337,7 +340,9 @@ export default class EntityName extends Mixins(CommonMixin, NameRequestMixin) {
this.hasCompanyNameChanged ||
(
this.hasBusinessNameChanged &&
(this.isAlterationFiling || this.isFirmChangeFiling || this.isSpecialResolutionFiling)
(this.isAlterationFiling || this.isFirmChangeFiling || this.isSpecialResolutionFiling ||
this.isLimitedRestorationToFull
)
)
) &&
!this.isNameChangedByType
Expand Down Expand Up @@ -439,8 +444,22 @@ export default class EntityName extends Mixins(CommonMixin, NameRequestMixin) {

/** Updates UI when correct name options are done. */
nameChangeHandler (isSaved = false): void {
this.hasCompanyNameChanged = this.isNewName
if (isSaved) this.isEditingNames = false
// check if this is a numbered company case:
// 1. no Name Request legal name exists (indicating not using NR)
// 2. business number exists (needed for numbered company name)
const isNumberedName = !this.getNameRequestLegalName && !!this.getBusinessNumber
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved
this.hasCompanyNameChanged = this.isNewName || isNumberedName

if (isSaved) {
this.isEditingNames = false

// set legal name for numbered company to satisfy Legal API requirement
// without this, Legal API will return error when filing restoration with numbered option
if (isNumberedName) {
const numberedName = `${this.getBusinessNumber} B.C. ${this.getUpdatedName}`
this.setNameRequestLegalName(numberedName)
}
}
}

/** Reset company name values to original. */
Expand Down
56 changes: 56 additions & 0 deletions tests/unit/EntityName.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { CorrectionResourceGp } from '@/resources/Correction/GP'
import { CorrectionResourceSp } from '@/resources/Correction/SP'
import { CorrectionResourceUlc } from '@/resources/Correction/ULC'

import { RestorationResourceBc } from '@/resources/LimitedRestorationToFull/BC'

import { SpecialResolutionResourceCp } from '@/resources/SpecialResolution/CP'

import { createPinia, setActivePinia } from 'pinia'
Expand Down Expand Up @@ -398,3 +400,57 @@ describe('Name Changes by Type change', () => {
)
})
})

describe('Name Changes for Limited Restoration to Full', () => {
let wrapper: any

const entitySnapshot = {
businessInfo: {
legalName: 'Mock Original Name',
legalType: CorpTypeCd.BC_COMPANY,
identifier: 'BC0884805'
}
}

beforeEach(() => {
// Set original business Data
store.stateModel.summaryMode = false
store.stateModel.nameRequestLegalName = entitySnapshot.businessInfo.legalName
store.stateModel.entitySnapshot = entitySnapshot as any
store.stateModel.tombstone.filingType = FilingTypes.RESTORATION
store.stateModel.tombstone.entityType = entitySnapshot.businessInfo.legalType
store.stateModel.tombstone.businessId = entitySnapshot.businessInfo.identifier
store.resourceModel = RestorationResourceBc

wrapper = mount(EntityName, {
vuetify,
computed: {
isLimitedRestorationToFull: () => true,
isNameChangedByType: () => false
}
})
})

afterEach(() => {
wrapper.destroy()
})

it('displays Undo button after changing to a numbered company and resuming draft', async () => {
// Initial state
const companyName = wrapper.find('.company-name')
expect(companyName.exists()).toBe(true)
expect(companyName.text()).toBe('Mock Original Name')

// Simulate changing to numbered company
store.stateModel.nameRequestLegalName = null

await wrapper.vm.nameChangeHandler(true)
await Vue.nextTick()

// Verify show the Undo button
const button = wrapper.find('#btn-undo-company-name')
expect(button.exists()).toBe(true)
expect(button.text()).toBe('Undo')
expect(wrapper.vm.shouldShowUndoButton).toBe(true)
})
})
Loading