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

Check no person giving notice by default for decal replacement #1993

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 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.41",
"version": "3.2.42",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
11 changes: 9 additions & 2 deletions ppr-ui/src/components/unitNotes/UnitNoteAdd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</template>

<script lang="ts">
import { computed, defineComponent, reactive, toRefs, watch } from 'vue'
import { computed, defineComponent, reactive, toRefs, watch, onMounted } from 'vue'
import { UnitNotesInfo } from '@/resources/unitNotes'
import { UnitNoteDocTypes } from '@/enums'
import { useStore } from '@/store/store'
Expand Down Expand Up @@ -136,7 +136,7 @@
: personGivingNoticeContent
),
isNoticeOfTaxSale: computed((): boolean => props.docType === UnitNoteDocTypes.NOTICE_OF_TAX_SALE),
hasNoPersonGivingNotice: (getMhrUnitNote.value as UnitNoteIF).hasNoPersonGivingNotice || false,
hasNoPersonGivingNotice: props.docType === UnitNoteDocTypes.DECAL_REPLACEMENT || (getMhrUnitNote.value as UnitNoteIF).hasNoPersonGivingNotice || false,

Check warning on line 139 in ppr-ui/src/components/unitNotes/UnitNoteAdd.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

This line has a length of 157. Maximum allowed is 120
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Also want to present an option: You could just watch the props.docType and if/when it's UnitNoteDocTypes.DECAL_REPLACEMENT set the localState/State and the validation in the same function.


// Remarks
unitNoteRemarks: (getMhrUnitNote.value as UnitNoteIF).remarks || '',
Expand Down Expand Up @@ -174,6 +174,13 @@
emit('isValid', localState.isUnitNoteValid)
})

onMounted(() => {
if(props.docType === UnitNoteDocTypes.DECAL_REPLACEMENT) {
setValidation(MhrSectVal.UNIT_NOTE_VALID, MhrCompVal.PERSON_GIVING_NOTICE_VALID, localState.hasNoPersonGivingNotice)

Check warning on line 179 in ppr-ui/src/components/unitNotes/UnitNoteAdd.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

This line has a length of 124. Maximum allowed is 120
handleStoreUpdate('hasNoPersonGivingNotice', localState.hasNoPersonGivingNotice)
}
})

return {
personGivingNoticeContent,
MhrCompVal,
Expand Down
46 changes: 37 additions & 9 deletions ppr-ui/tests/unit/MhrUnitNote.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ describe('MHR Unit Note Filing', async () => {
})

it('should not show field errors when no person giving notice checkbox is checked', async () => {
wrapper = await createUnitNoteComponent(UnitNoteDocTypes.DECAL_REPLACEMENT)
wrapper = await createUnitNoteComponent(UnitNoteDocTypes.PUBLIC_NOTE)

let UnitNoteAddComponent = wrapper.findComponent(UnitNoteAdd)
expect(UnitNoteAddComponent.findAll('.border-error-left').length).toBe(0)
Expand All @@ -210,9 +210,9 @@ describe('MHR Unit Note Filing', async () => {

expect(wrapper.findComponent(UnitNoteReview).exists()).toBeFalsy()

// Asserts error shown before checking the checkbox
expect(UnitNoteAddComponent.findAll('.border-error-left').length).toBe(2)
expect(UnitNoteAddComponent.findAll('.error-text').length).toBe(2)
// Asserts error shown before checking the checkbox(document ID, remarks, contactInfo)
expect(UnitNoteAddComponent.findAll('.border-error-left').length).toBe(3)
expect(UnitNoteAddComponent.findAll('.error-text').length).toBe(3)

const PersonGivingNoticeComponent = UnitNoteAddComponent.findComponent(ContactInformation)

Expand All @@ -228,9 +228,9 @@ describe('MHR Unit Note Filing', async () => {
// Assert contact form is disabled
expect(PersonGivingNoticeComponent.find('#contact-info').exists()).toBeFalsy()

// Asserts error not shown after checking the checkbox (1 error remains from doucment ID)
expect(UnitNoteAddComponent.findAll('.border-error-left').length).toBe(1)
expect(UnitNoteAddComponent.findAll('.error-text').length).toBe(1)
// Asserts error not shown after checking the checkbox (2 error remains from doucment ID and remarks)
expect(UnitNoteAddComponent.findAll('.border-error-left').length).toBe(2)
expect(UnitNoteAddComponent.findAll('.error-text').length).toBe(2)
expect(PersonGivingNoticeComponent.findAll('.error-text').length).toBe(0)

// uncheck the checkbox
Expand All @@ -239,8 +239,8 @@ describe('MHR Unit Note Filing', async () => {
expect(store.getMhrUnitNote.hasNoPersonGivingNotice).toBe(false)

// Asserts error shown after the checkbox is unchecked and form is not disabled
expect(UnitNoteAddComponent.findAll('.border-error-left').length).toBe(2)
expect(UnitNoteAddComponent.findAll('.error-text').length).toBe(2)
expect(UnitNoteAddComponent.findAll('.border-error-left').length).toBe(3)
expect(UnitNoteAddComponent.findAll('.error-text').length).toBe(3)
expect(PersonGivingNoticeComponent.findAll('.error-text').length).toBeGreaterThan(0)
expect(PersonGivingNoticeComponent.find('#contact-info').classes('v-card--disabled')).toBe(false)

Expand Down Expand Up @@ -270,6 +270,34 @@ describe('MHR Unit Note Filing', async () => {
.checked).toBe(true)
})

it('Person Giving Notice should be checked if doctype is decal replacement', async () => {
wrapper = await createUnitNoteComponent(UnitNoteDocTypes.DECAL_REPLACEMENT)

let UnitNoteAddComponent = wrapper.findComponent(UnitNoteAdd)

expect((UnitNoteAddComponent.find('#no-person-giving-notice-checkbox').element as HTMLInputElement)
.checked).toBe(true)
await wrapper.find('#btn-stacked-submit').trigger('click')
await nextTick()

expect(wrapper.findComponent(UnitNoteReview).exists()).toBeFalsy()

// Asserts error shown before checking the checkbox(document ID)
expect(UnitNoteAddComponent.findAll('.border-error-left').length).toBe(1)
expect(UnitNoteAddComponent.findAll('.error-text').length).toBe(1)


await wrapper.findComponent(UnitNoteAdd).vm.$emit('isValid', true)
await wrapper.find('#btn-stacked-submit').trigger('click')
await nextTick()

// should be on the Review & Confirm screen
expect(wrapper.findComponent(UnitNoteReview).exists()).toBeTruthy()

// 'There no Person Giving Notice...' should be shown next to Person Giving Notice
expect(wrapper.find('.no-person-giving-notice').text())
.toBe(hasNoPersonGivingNoticeText)
})
// eslint-disable-next-line max-len
it('should not show EffectiveDate component for Decal Replacement, Public Note, and Confidential Note', async () => {
wrapper = await createUnitNoteComponent(UnitNoteDocTypes.DECAL_REPLACEMENT)
Expand Down
Loading