Skip to content

Commit

Permalink
Fix to show correct error when all home owners deleted (#1957)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimak1 authored Jun 28, 2024
1 parent ba02924 commit 3f4ea99
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 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.28",
"version": "3.2.29",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,14 @@ export default defineComponent({
item.groupId
)
const group: MhrRegistrationHomeOwnerGroupIF = getGroupById(item.groupId)
const isEmptyGroup = group.owners.every(owner => owner.action === ActionTypes.REMOVED)
// mark empty groups as removed to show the 'No owners added yet' error
if (isEmptyGroup) {
group.action = ActionTypes.REMOVED
}
// When base ownership is SO/JT and all current owners have been removed: Move them to a previous owners group.
if (groupHasRemovedAllCurrentOwners(getGroupById(item.groupId)) && showGroups.value) {
moveCurrentOwnersToPreviousOwners(getGroupById(item.groupId))
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/tests/unit/MhrTransferHomeOwners.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ describe('Home Owners', () => {
expect(allDeletedBadges.length).toBe(1)

expect(homeOwners.find(getTestId('invalid-group-msg')).exists()).toBeFalsy()
expect(homeOwners.find(getTestId('no-data-msg')).exists()).toBeFalsy()
expect(homeOwners.find(getTestId('no-data-msg')).exists()).toBeTruthy()

const deletedOwner: MhrRegistrationHomeOwnerIF =
homeOwners.vm.getMhrTransferHomeOwnerGroups[0].owners[0]
Expand Down

0 comments on commit 3f4ea99

Please sign in to comment.