diff --git a/ppr-ui/package-lock.json b/ppr-ui/package-lock.json
index 822afb00c..28ecef9fc 100644
--- a/ppr-ui/package-lock.json
+++ b/ppr-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "ppr-ui",
- "version": "3.2.21",
+ "version": "3.2.22",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ppr-ui",
- "version": "3.2.21",
+ "version": "3.2.22",
"dependencies": {
"@bcrs-shared-components/input-field-date-picker": "^1.0.0",
"@lemoncode/fonk": "^1.5.1",
diff --git a/ppr-ui/package.json b/ppr-ui/package.json
index b846cb703..85da9e300 100644
--- a/ppr-ui/package.json
+++ b/ppr-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
- "version": "3.2.21",
+ "version": "3.2.22",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
diff --git a/ppr-ui/src/components/common/CollapsibleCard.vue b/ppr-ui/src/components/common/CollapsibleCard.vue
new file mode 100644
index 000000000..be8d8ee85
--- /dev/null
+++ b/ppr-ui/src/components/common/CollapsibleCard.vue
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ppr-ui/src/components/common/index.ts b/ppr-ui/src/components/common/index.ts
index 85066b28c..456bdfefd 100644
--- a/ppr-ui/src/components/common/index.ts
+++ b/ppr-ui/src/components/common/index.ts
@@ -38,3 +38,4 @@ export { default as ReviewCard } from './ReviewCard.vue'
export { default as LienAlert } from './LienAlert.vue'
export { default as UpdatedBadge } from './UpdatedBadge.vue'
export { default as StaffPayment } from './StaffPayment.vue'
+export { default as CollapsibleCard } from './CollapsibleCard.vue'
diff --git a/ppr-ui/src/components/mhrRegistration/HomeOwners/HomeOwnersTable.vue b/ppr-ui/src/components/mhrRegistration/HomeOwners/HomeOwnersTable.vue
index f39cb7938..e27223165 100644
--- a/ppr-ui/src/components/mhrRegistration/HomeOwners/HomeOwnersTable.vue
+++ b/ppr-ui/src/components/mhrRegistration/HomeOwners/HomeOwnersTable.vue
@@ -3,7 +3,7 @@
id="home-owner-table-card"
flat
rounded
- :class="{ 'border-error-left': showTableError }"
+ :class="{ 'border-error-left': showTableError && !hideTableErrors }"
>
+
+
@@ -423,6 +425,7 @@
import { computed, defineComponent, onBeforeMount, reactive, toRefs, watch } from 'vue'
import { useStore } from '@/store/store'
import { AddEditHomeOwner, HomeOwnersTable } from '@/components/mhrRegistration/HomeOwners'
+import PreviousHomeOwners from '@/components/mhrRegistration/HomeOwners/PreviousHomeOwners.vue'
import { BaseDialog } from '@/components/dialogs'
import { SimpleHelpToggle } from '@/components/common'
import {
@@ -430,11 +433,12 @@ import {
useMhrCorrections,
useMhrInformation,
useMhrValidations,
+ useNavigation,
useTransferOwners
} from '@/composables'
import { MhrRegistrationHomeOwnerGroupIF } from '@/interfaces'
-import { ActionTypes } from '@/enums'
+import { ActionTypes, RouteNames } from '@/enums'
import { transfersErrors } from '@/resources'
import { formatCurrency } from '@/utils'
@@ -446,7 +450,8 @@ export default defineComponent({
AddEditHomeOwner,
BaseDialog,
HomeOwnersTable,
- SimpleHelpToggle
+ SimpleHelpToggle,
+ PreviousHomeOwners
},
props: {
isMhrTransfer: {
@@ -466,6 +471,7 @@ export default defineComponent({
setup (props, context) {
const {
isRoleStaff,
+ isMhrReRegistration,
getMhrTransferHomeOwnerGroups,
getMhrTransferCurrentHomeOwnerGroups,
getMhrRegistrationValidationModel,
@@ -475,6 +481,8 @@ export default defineComponent({
getMhrTransferDeclaredValue
} = storeToRefs(useStore())
+ const { isRouteName } = useNavigation()
+
const {
getUiTransferType,
isFrozenMhrDueToUnitNote
@@ -587,7 +595,11 @@ export default defineComponent({
}),
changesRequired: computed((): boolean => {
return props.validateTransfer && !hasUnsavedChanges.value
- })
+ }),
+ showPreviousHomeOwners: computed((): boolean =>
+ // show only for Mhr Re-Registration flow on Home Owners step
+ isMhrReRegistration.value && isRouteName(RouteNames.HOME_OWNERS)
+ )
})
const hideShowRemovedOwners = (forceShow: boolean = false): void => {
diff --git a/ppr-ui/tests/unit/MhrInformation.spec.ts b/ppr-ui/tests/unit/MhrInformation.spec.ts
index 20347e745..e3e3382e6 100644
--- a/ppr-ui/tests/unit/MhrInformation.spec.ts
+++ b/ppr-ui/tests/unit/MhrInformation.spec.ts
@@ -26,7 +26,7 @@ import {
ProductType,
ProductStatus
} from '@/enums'
-import { HomeOwnersTable } from '@/components/mhrRegistration/HomeOwners'
+import { HomeOwnersTable, PreviousHomeOwners } from '@/components/mhrRegistration/HomeOwners'
import { createComponent, getTestId } from './utils'
import {
mockedAddedPerson,
@@ -157,6 +157,8 @@ describe('Mhr Information', async () => {
expect(wrapper.findComponent(TransferType).exists()).toBe(false)
expect(wrapper.findComponent(HomeOwners).exists()).toBeTruthy()
+ expect(wrapper.findComponent(HomeOwners).findComponent(PreviousHomeOwners).exists()).toBeFalsy()
+
const homeOwnersTable = wrapper.findComponent(HomeOwnersTable)
expect(homeOwnersTable.exists()).toBeTruthy()
expect(homeOwnersTable.text()).toContain(mockMhrTransferCurrentHomeOwner.owners[0].organizationName)
@@ -955,6 +957,7 @@ describe('Mhr Information', async () => {
const homeOwnersComponent = wrapper.findComponent(HomeOwners)
await store.setMhrTransferHomeOwnerGroups(homeOwnerGroup)
expect(homeOwnersComponent.findComponent(HomeOwnersTable).exists()).toBeTruthy()
+ expect(homeOwnersComponent.findComponent(PreviousHomeOwners).exists()).toBeFalsy()
// check owners are in table
expect(homeOwnersComponent.vm.getHomeOwners.length).toBe(2)
diff --git a/ppr-ui/tests/unit/MhrRegistration.spec.ts b/ppr-ui/tests/unit/MhrRegistration.spec.ts
index 189695fc4..cf3d6d6c1 100644
--- a/ppr-ui/tests/unit/MhrRegistration.spec.ts
+++ b/ppr-ui/tests/unit/MhrRegistration.spec.ts
@@ -7,16 +7,18 @@ import { ButtonFooter } from '@/components/common'
import { Stepper, StickyContainer } from '@/components/common'
import { MhrCorrectionStaff, MhrReRegistrationType, MhrRegistrationType } from '@/resources'
import { defaultFlagSet } from '@/utils'
-import { AuthRoles, MhApiStatusTypes, RouteNames } from '@/enums'
-import { mockMhrReRegistration, mockedManufacturerAuthRoles, mockedMhrRegistration } from './test-data'
+import { AuthRoles, HomeTenancyTypes, MhApiStatusTypes, RouteNames } from '@/enums'
+import { mockMhrReRegistration, mockedManufacturerAuthRoles, mockedMhrRegistration, mockedPerson } from './test-data'
import { createComponent, getTestId } from './utils'
-import { useNewMhrRegistration } from '@/composables'
+import { useMhrReRegistration, useNewMhrRegistration } from '@/composables'
import { nextTick } from 'vue'
import CautionBox from '@/components/common/CautionBox.vue'
import HomeOwnersTable from '@/components/mhrRegistration/HomeOwners/HomeOwnersTable.vue'
import SubmittingParty from '@/views/newMhrRegistration/SubmittingParty.vue'
import HomeLocation from '@/views/newMhrRegistration/HomeLocation.vue'
import HomeOwners from '@/views/newMhrRegistration/HomeOwners.vue'
+import { MhrRegistrationHomeOwnerGroupIF } from '@/interfaces'
+import { PreviousHomeOwners } from '@/components/mhrRegistration'
const store = useStore()
@@ -116,6 +118,8 @@ describe('Mhr Re-Registration', () => {
})
await nextTick()
+ const homeOwnerGroup = [{ groupId: 1, owners: [mockedPerson] }] as MhrRegistrationHomeOwnerGroupIF[]
+ useMhrReRegistration().setupPreviousOwners(homeOwnerGroup)
useNewMhrRegistration().initDraftOrCurrentMhr(mockMhrReRegistration as any, false)
await nextTick()
@@ -123,7 +127,6 @@ describe('Mhr Re-Registration', () => {
})
it('renders and displays the Mhr Re-Registration View', async () => {
-
expect(wrapper.findComponent(MhrRegistration).exists()).toBe(true)
expect(wrapper.find('#re-registration-header h1').text()).toBe(MhrReRegistrationType.registrationTypeUI)
expect(wrapper.vm.$route.name).toBe(RouteNames.SUBMITTING_PARTY)
@@ -138,6 +141,19 @@ describe('Mhr Re-Registration', () => {
expect(homeOwnersTable.find(getTestId('no-data-msg')).exists()).toBe(true) // should not have owners for Re-Reg
expect(wrapper.findComponent(HomeOwners).findComponent(CautionBox).exists()).toBe(false)
+ // Previous Home Owners
+ const prevOwnersCard = wrapper.findComponent(PreviousHomeOwners)
+ expect(prevOwnersCard.exists()).toBe(true)
+ expect(prevOwnersCard.find(getTestId('card-header-label')).text()).toBe('Previous Home Owners')
+ expect(prevOwnersCard.find(getTestId('card-toggle-label')).text()).toBe('Hide Previous Owners')
+ expect(prevOwnersCard.find(getTestId('home-owner-tenancy-type')).text()).toContain(HomeTenancyTypes.SOLE)
+ expect(prevOwnersCard.findComponent(HomeOwnersTable).exists()).toBe(true)
+
+ const homeOwnersTableText = prevOwnersCard.findComponent(HomeOwnersTable).text()
+ expect(homeOwnersTableText).toContain(mockedPerson.individualName.first)
+ expect(homeOwnersTableText).toContain(mockedPerson.phoneNumber)
+ expect(homeOwnersTableText).toContain(mockedPerson.address.street)
+
// Go to Home Location step
wrapper.findComponent(Stepper).findAll('.step').at(3).trigger('click')
await nextTick()
diff --git a/ppr-ui/tests/unit/MhrTransferHomeOwners.spec.ts b/ppr-ui/tests/unit/MhrTransferHomeOwners.spec.ts
index f3423aa20..1c534fc68 100644
--- a/ppr-ui/tests/unit/MhrTransferHomeOwners.spec.ts
+++ b/ppr-ui/tests/unit/MhrTransferHomeOwners.spec.ts
@@ -7,7 +7,8 @@ import {
HomeOwnersTable,
HomeOwnerGroups,
TableGroupHeader,
- HomeOwnerRoles
+ HomeOwnerRoles,
+ PreviousHomeOwners
} from '@/components/mhrRegistration/HomeOwners'
import { InfoChip, InputFieldDatePicker, SimpleHelpToggle } from '@/components/common'
import {
@@ -121,6 +122,7 @@ describe('Home Owners', () => {
expect(wrapper.findComponent(AddEditHomeOwner).exists()).toBeFalsy() // Hidden by default
expect(wrapper.findComponent(HomeOwnersTable).exists()).toBeTruthy()
expect(wrapper.findComponent(SimpleHelpToggle).exists()).toBeFalsy() // Verify it doesn't render in Transfers
+ expect(wrapper.findComponent(PreviousHomeOwners).exists()).toBeFalsy()
})
it('renders Add Edit Home Owner and its sub components', async () => {
@@ -1099,6 +1101,7 @@ describe('Home Owners', () => {
await selectTransferType(ApiTransferTypes.TO_EXECUTOR_PROBATE_WILL)
const homeOwners = wrapper.findComponent(HomeOwners)
+ expect(homeOwners.findComponent(PreviousHomeOwners).exists()).toBeFalsy()
await homeOwners.find(getTestId('table-delete-btn')).trigger('click')
// error should not be shown when removing one out of two Executors in the group
expect(homeOwners.find(getTestId('invalid-group-msg')).exists()).toBeFalsy()
diff --git a/ppr-ui/tests/unit/common-components/CollapsibleCard.spec.ts b/ppr-ui/tests/unit/common-components/CollapsibleCard.spec.ts
new file mode 100644
index 000000000..b657dd54f
--- /dev/null
+++ b/ppr-ui/tests/unit/common-components/CollapsibleCard.spec.ts
@@ -0,0 +1,44 @@
+import CollapsibleCard from '@/components/common/CollapsibleCard.vue'
+import { getTestId } from '../utils'
+import { mount } from '@vue/test-utils'
+import { nextTick } from 'vue'
+
+describe('CollapsibleCard', () => {
+ let wrapper: any
+
+ const HEADER_LABEL = 'Main Header Label'
+ const TOGGLE_LABEL = 'Toggle Label'
+
+ beforeEach(async () => {
+ wrapper = mount(CollapsibleCard, {
+ props: {
+ headerLabel: HEADER_LABEL,
+ toggleLabel: TOGGLE_LABEL
+ },
+ slots: {
+ infoSlot: 'Info Content
',
+ mainSlot: 'Main Content
'
+ }
+ })
+ })
+
+ it('renders component with props', async () => {
+ const collapsibleCard = wrapper.findComponent(CollapsibleCard)
+ expect(collapsibleCard.exists()).toBe(true)
+ expect(collapsibleCard.find(getTestId('card-header-label')).text()).toBe(HEADER_LABEL)
+ expect(collapsibleCard.find(getTestId('card-toggle-label')).text()).toBe('Hide ' + TOGGLE_LABEL)
+
+ const cardSlots = collapsibleCard.find(getTestId('card-slots'))
+
+ expect(cardSlots.exists()).toBe(true)
+ expect(cardSlots.text()).toContain('Info Content')
+ expect(cardSlots.text()).toContain('Main Content')
+
+ // collapse the card and slots
+ collapsibleCard.vm.toggleCardOpen()
+ await nextTick()
+
+ expect(collapsibleCard.find(getTestId('card-slots')).exists()).toBe(false)
+ expect(collapsibleCard.find(getTestId('card-toggle-label')).text()).toBe('Show ' + TOGGLE_LABEL)
+ })
+})