Skip to content

Commit

Permalink
13809 ppr search result displaying selection list (#1985)
Browse files Browse the repository at this point in the history
* added mhr-searh breadcrumb data

* updated version number

* Fixed error on unit test
  • Loading branch information
flutistar authored Jul 18, 2024
1 parent 185ef90 commit 71bcfcb
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 14 deletions.
4 changes: 2 additions & 2 deletions ppr-ui/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 ppr-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
"version": "3.2.40",
"version": "3.2.41",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
15 changes: 10 additions & 5 deletions ppr-ui/src/components/common/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ import {
tombstoneBreadcrumbRenewal,
tombstoneBreadcrumbAmendment,
tombstoneBreadcrumbRegistration,
tombstoneBreadcrumbSearch,
tombstoneBreadcrumbPprSearch,
tombstoneBreadcrumbMhrSearch,
tombstoneBreadcrumbSearchConfirm,
breadcrumbsTitles,
tombstoneBreadcrumbMhrInformation,
Expand Down Expand Up @@ -124,7 +125,8 @@ export default defineComponent({
tombstoneBreadcrumbRenewal,
tombstoneBreadcrumbAmendment,
tombstoneBreadcrumbRegistration,
tombstoneBreadcrumbSearch,
tombstoneBreadcrumbPprSearch,
tombstoneBreadcrumbMhrSearch,
tombstoneBreadcrumbSearchConfirm,
tombstoneBreadcrumbMhrInformation,
tombstoneBreadcrumbMhrCorrection,
Expand All @@ -139,9 +141,12 @@ export default defineComponent({
if ((name === RouteNames.DASHBOARD) || (name === RouteNames.SIGN_IN)) {
tombstoneBreadcrumbDashboard[1].text = roleBasedBreadcrumbTitle || tombstoneBreadcrumbDashboard[1].text
return tombstoneBreadcrumbDashboard
} else if ((name === RouteNames.SEARCH) || (name === RouteNames.MHRSEARCH)) {
tombstoneBreadcrumbSearch[1].text = roleBasedBreadcrumbTitle
return tombstoneBreadcrumbSearch
} else if (name === RouteNames.SEARCH) {
tombstoneBreadcrumbPprSearch[1].text = roleBasedBreadcrumbTitle
return tombstoneBreadcrumbPprSearch
} else if (name === RouteNames.MHRSEARCH) {
tombstoneBreadcrumbMhrSearch[1].text = roleBasedBreadcrumbTitle
return tombstoneBreadcrumbMhrSearch
} else if (name === RouteNames.MHRSEARCH_CONFIRM) {
tombstoneBreadcrumbSearchConfirm[1].text = roleBasedBreadcrumbTitle ||
tombstoneBreadcrumbSearchConfirm[1].text
Expand Down
19 changes: 18 additions & 1 deletion ppr-ui/src/resources/breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,24 @@ export const tombstoneBreadcrumbRegistration: Array<BreadcrumbIF> = [
to: { name: '' }
}
]
export const tombstoneBreadcrumbSearch: Array<BreadcrumbIF> = [
export const tombstoneBreadcrumbPprSearch: Array<BreadcrumbIF> = [
{
disabled: false,
href: sessionStorage.getItem('REGISTRY_URL'),
text: 'BC Registries Dashboard'
},
{
disabled: false,
to: { name: RouteNames.DASHBOARD },
text: 'My Personal Property Registry'
},
{
disabled: true,
text: 'Search Results',
to: { name: '' }
}
]
export const tombstoneBreadcrumbMhrSearch: Array<BreadcrumbIF> = [
{
disabled: false,
href: sessionStorage.getItem('REGISTRY_URL'),
Expand Down
27 changes: 22 additions & 5 deletions ppr-ui/tests/unit/Breadcrumb.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
tombstoneBreadcrumbDashboard,
tombstoneBreadcrumbDischarge,
tombstoneBreadcrumbRegistration,
tombstoneBreadcrumbSearch,
tombstoneBreadcrumbPprSearch,
tombstoneBreadcrumbMhrSearch,
tombstoneBreadcrumbAmendment,
tombstoneBreadcrumbRenewal,
breadcrumbsTitles
Expand Down Expand Up @@ -58,11 +59,27 @@ describe('Breadcrumb component tests', () => {
expect(wrapper.find(backBtn).exists()).toBe(true)

const breadcrumbs = wrapper.findAll(getTestId('breadcrumb-item'))
expect(breadcrumbs.length).toBe(tombstoneBreadcrumbSearch.length)
expect(breadcrumbs.length).toBe(tombstoneBreadcrumbPprSearch.length)

tombstoneBreadcrumbSearch[1].text = breadcrumbsTitles[userRoleProductCode]
for (let i = 0; i < tombstoneBreadcrumbSearch.length; i++) {
expect(breadcrumbs.at(i).text()).toContain(wrapper.vm.handleStaff(tombstoneBreadcrumbSearch[i].text))
tombstoneBreadcrumbPprSearch[1].text = breadcrumbsTitles[userRoleProductCode]
for (let i = 0; i < tombstoneBreadcrumbPprSearch.length; i++) {
expect(breadcrumbs.at(i).text()).toContain(wrapper.vm.handleStaff(tombstoneBreadcrumbPprSearch[i].text))
}
})

it('renders on MHR search with breadcrumb', async () => {
wrapper = await createComponent(Breadcrumb, null, RouteNames.MHRSEARCH)
await nextTick()

const userRoleProductCode = getRoleProductCode(store.getUserRoles, [ProductCode.PPR])
expect(wrapper.find(backBtn).exists()).toBe(true)

const breadcrumbs = wrapper.findAll(getTestId('breadcrumb-item'))
expect(breadcrumbs.length).toBe(tombstoneBreadcrumbMhrSearch.length)

tombstoneBreadcrumbMhrSearch[1].text = breadcrumbsTitles[userRoleProductCode]
for (let i = 0; i < tombstoneBreadcrumbMhrSearch.length; i++) {
expect(breadcrumbs.at(i).text()).toContain(wrapper.vm.handleStaff(tombstoneBreadcrumbMhrSearch[i].text))
}
})

Expand Down

0 comments on commit 71bcfcb

Please sign in to comment.