Skip to content

Commit

Permalink
Merge pull request #3704 from GovAlta/CS-3634-d
Browse files Browse the repository at this point in the history
fix(address preview) - fix regressions
  • Loading branch information
jonathanweyermann authored Nov 12, 2024
2 parents 264ff69 + 6055109 commit 1b18715
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ describe('AddressLookUpControlReview', () => {
data: {
addressLine1: '10111 111 ave',
addressLine2: 'Second unit',
city: 'Edmonton',
province: 'AB',
municipality: 'Edmonton',
subdivisionCode: 'AB',
postalCode: 'T6G 1E1',
country: 'CAN',
},
Expand All @@ -46,7 +46,7 @@ describe('AddressLookUpControlReview', () => {
},
},
},
required: ['addressLine1', 'city', 'province', 'postalCode', 'country'], // Ensure required is at the root level
required: ['addressLine1', 'municipality', 'subdivisionCode', 'postalCode', 'country'], // Ensure required is at the root level
} as unknown as ControlElement,
scope: '#/properties/lastName',
uischema: {
Expand Down Expand Up @@ -97,10 +97,10 @@ describe('AddressLookUpControlReview', () => {
it('should render the component with input fields with a different province ', () => {
renderComponent({
data: {
province: 'BC',
subdivisionCode: 'BC',
addressLine1: '10111 111 ave',
addressLine2: 'Second unit',
city: 'Edmonton',
municipality: 'Vancouver',
postalCode: 'T6G 1E1',
country: 'CAN',
},
Expand All @@ -113,7 +113,7 @@ describe('AddressLookUpControlReview', () => {

expect(screen.getByText('British Columbia')).toBeInTheDocument();
expect(screen.getByText('Canada')).toBeInTheDocument();
expect(screen.getByText('Edmonton')).toBeInTheDocument();
expect(screen.getByText('Vancouver')).toBeInTheDocument();
expect(screen.getByText('10111 111 ave')).toBeInTheDocument();
expect(screen.getByText('T6G 1E1')).toBeInTheDocument();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const AddressViews: React.FC<AddressInputsProps> = ({
<GoAGrid minChildWidth="0" gap="s">
<GoAFormItem
error={data?.addressLine1?.length === 0 ? 'addressLine1 is required' : ''}
label={`${isAlbertaAddress ? 'Alberta p' : 'P'}ostal address`}
label={`${isAlbertaAddress ? 'Alberta p' : 'Canada p'}ostal address`}
>
<p>{data?.addressLine1}</p>
</GoAFormItem>
Expand All @@ -45,7 +45,7 @@ export const AddressViews: React.FC<AddressInputsProps> = ({
<br />
<GoAGrid minChildWidth="0ch" gap="s">
<GoAFormItem error={data?.municipality?.length === 0 ? 'city is required' : ''} label="City">
<p>{data?.city}</p>
<p>{data?.municipality}</p>
</GoAFormItem>
<GoAFormItem error={data?.postalCode?.length === 0 ? 'postalCode is required' : ''} label="Postal Code">
<p>{data?.postalCode}</p>
Expand All @@ -57,7 +57,7 @@ export const AddressViews: React.FC<AddressInputsProps> = ({
{isAlbertaAddress && <div data-testid="address-form-province-view">Alberta</div>}
{!isAlbertaAddress && (
<div data-testid="address-form-province-view">
{provinces.find((p) => p.value === data?.province)?.label}
{provinces.find((p) => p.value === data?.subdivisionCode)?.label}
</div>
)}
</GoAFormItem>
Expand Down

0 comments on commit 1b18715

Please sign in to comment.