Skip to content

Commit

Permalink
Optional International Address
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds committed Oct 25, 2024
1 parent 3d59dbf commit 054f2dc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 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.69",
"version": "3.2.70",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
7 changes: 6 additions & 1 deletion ppr-ui/src/composables/address/BaseAddress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export default defineComponent({
} = useAddress(toRef(addressProp), localSchema)
const origPostalCodeRules = localSchema.postalCode
const origRegionRules = localSchema.region
const origCityRules = localSchema.city
const { addressForm, validate } = useBaseValidations()
Expand All @@ -256,12 +257,16 @@ export default defineComponent({
if (val === 'CA') {
localSchema.postalCode = origPostalCodeRules.concat([baseRules.postalCode])
localSchema.region = origRegionRules
localSchema.city = origCityRules
} else if (val === 'US') {
localSchema.postalCode = origPostalCodeRules.concat([baseRules.zipCode])
localSchema.region = origRegionRules
localSchema.city = origCityRules
} else {
localSchema.postalCode = origPostalCodeRules.concat([baseRules.maxLength(15)])
// Convert to optional rules for non-CA/US countries
localSchema.postalCode = [baseRules.maxLength(15), ...spaceRules]
localSchema.region = [baseRules.maxLength(2), ...spaceRules]
localSchema.city = [baseRules.maxLength(40), ...spaceRules]
}
// reset other address fields (check is for loading an existing address)
if (oldVal) {
Expand Down
23 changes: 8 additions & 15 deletions ppr-ui/src/views/newRegistration/AddCollateral.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<span
<v-container
v-if="dataLoaded"
class="footer-view-container pa-0"
class="pa-0 footer-view-container"
>
<div class="py-0">
<div class="container pa-0 pt-4">
Expand Down Expand Up @@ -65,19 +65,12 @@
</v-row>
</div>
</div>
<v-row
noGutters
class="pt-10"
>
<v-col cols="12">
<ButtonFooter
:navConfig="getFooterButtonConfig"
:currentStepName="stepName"
@error="emitError($event)"
/>
</v-col>
</v-row>
</span>
<ButtonFooter
:navConfig="getFooterButtonConfig"
:currentStepName="stepName"
@error="emitError($event)"
/>
</v-container>
</template>

<script lang="ts">
Expand Down
4 changes: 2 additions & 2 deletions ppr-ui/tests/unit/ContactInformation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe('Contact Information', () => {

expect(wrapper.vm.contactInfoType).toBe(ContactTypes.PERSON)
expect(wrapper.find(BORDER_ERROR).exists()).toBe(true)
// errors: first name, last name, country, address, city, postal code
expect(wrapper.findAll(ERROR_MSG).length).toBe(6)
// With no country selected - errors: first name, last name, country, address line 1
expect(wrapper.findAll(ERROR_MSG).length).toBe(4)
})
})
6 changes: 4 additions & 2 deletions ppr-ui/tests/unit/SecuredPartyValidation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ describe('Secured Party validation tests - business', () => {
await flushPromises()
await nextTick()
const messages = wrapper.findAll(ERROR_MSG)
expect(messages.length).toBe(5)
// With no country selected - errors: business name, country, address line 1
expect(messages.length).toBe(3)
expect(messages.at(0).text()).toBe('Please enter a business name')
})
})
Expand All @@ -55,7 +56,8 @@ describe('Secured Party validation tests - individual', () => {
await flushPromises()

const messages = wrapper.findAll(ERROR_MSG)
expect(messages.length).toBe(6)
// With no country selected - errors: first name, last name, country, address line 1
expect(messages.length).toBe(4)
expect(messages.at(0).text()).toBe('Please enter a first name')
expect(messages.at(1).text()).toBe('Please enter a last name')
})
Expand Down

0 comments on commit 054f2dc

Please sign in to comment.