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

Ask VA 1229 - Issues with address validation #33228

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
useEffect(() => {
getApiData(`${envUrl}${URL.ADDRESS_VALIDATION}`);
focusElement('#address-validation-alert-heading');
}, []);

Check warning on line 84 in src/applications/ask-va/components/FormFields/AddressValidationRadio.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/ask-va/components/FormFields/AddressValidationRadio.jsx:84:6:React Hook useEffect has a missing dependency: 'getApiData'. Either include it or remove the dependency array.

Check warning on line 84 in src/applications/ask-va/components/FormFields/AddressValidationRadio.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/ask-va/components/FormFields/AddressValidationRadio.jsx:84:6:React Hook useEffect has a missing dependency: 'getApiData'. Either include it or remove the dependency array.

useEffect(
() => {
Expand All @@ -89,7 +89,7 @@
handleValueChange(apiData[0].address, '0');
}
},
[apiData],

Check warning on line 92 in src/applications/ask-va/components/FormFields/AddressValidationRadio.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/ask-va/components/FormFields/AddressValidationRadio.jsx:92:5:React Hook useEffect has a missing dependency: 'handleValueChange'. Either include it or remove the dependency array.

Check warning on line 92 in src/applications/ask-va/components/FormFields/AddressValidationRadio.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/ask-va/components/FormFields/AddressValidationRadio.jsx:92:5:React Hook useEffect has a missing dependency: 'handleValueChange'. Either include it or remove the dependency array.
);

const renderAddressOption = (address, id = 'userEntered') => {
Expand All @@ -115,21 +115,19 @@
htmlFor={id}
className="vads-u-margin-top--2 vads-u-display--flex vads-u-align-items--center"
>
<div className="vads-u-display--flex vads-u-flex-direction--column vads-u-padding-bottom--0p5">
<span
className="dd-privacy-hidden"
data-dd-action-name="street address"
>
{addressStreet}
</span>
<span
className="dd-privacy-hidden"
data-dd-action-name="city, state and zip code"
>
{cityStateZip}
</span>
<span>{addressCountry}</span>
</div>
<span
className="dd-privacy-hidden"
data-dd-action-name="street address"
>
{addressStreet}
</span>
<span
className="dd-privacy-hidden vads-u-margin-left--0p5"
data-dd-action-name="city, state and zip code"
>
{cityStateZip}
</span>
<span>{addressCountry}</span>
</label>
</div>
);
Expand Down
13 changes: 9 additions & 4 deletions src/applications/ask-va/config/helpers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
isQuestionAboutVeteranOrSomeoneElseLabels,
relationshipOptionsSomeoneElse,
statesRequiringPostalCode,
TopicAppraisalsSpeciallyAdapatedHousing,
TopicAppraisals,
TopicSpeciallyAdapatedHousing,
TopicVeteranReadinessAndEmploymentChapter31,
whoIsYourQuestionAboutLabels,
} from '../constants';
Expand Down Expand Up @@ -446,9 +447,12 @@ export const isPostalCodeRequired = data => {
return true;
}

// Check general question
// Flow 3.1
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
if (whoIsYourQuestionAbout === whoIsYourQuestionAboutLabels.GENERAL) {
if (
whoIsYourQuestionAbout === whoIsYourQuestionAboutLabels.GENERAL &&
statesRequiringPostalCode.includes(veteransLocationOfResidence)
) {
return true;
}

Expand All @@ -462,6 +466,7 @@ export const isStateOfPropertyRequired = data => {

return (
selectCategory === CategoryHousingAssistanceAndHomeLoans &&
selectTopic === TopicAppraisalsSpeciallyAdapatedHousing
(selectTopic === TopicSpeciallyAdapatedHousing ||
selectTopic === TopicAppraisals)
);
};
3 changes: 2 additions & 1 deletion src/applications/ask-va/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ export const CategoryHousingAssistanceAndHomeLoans =
// Topics
export const TopicVeteranReadinessAndEmploymentChapter31 =
'Veteran Readiness and Employment (Chapter 31)';
export const TopicAppraisalsSpeciallyAdapatedHousing =
export const TopicSpeciallyAdapatedHousing =
'Specially Adapted Housing (SAH) and Special Home Adaptation (SHA) grants';
export const TopicAppraisals = 'Appraisals';
export const requireSignInCategories = [
CategoryEducation,
'Education benefits and work study',
Expand Down
2 changes: 1 addition & 1 deletion src/applications/ask-va/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function formatAddress(address) {
break;

default:
cityStateZip = `${city || militaryPostOffice} ${stateName} ${zip}` || '';
cityStateZip = `${city || militaryPostOffice}, ${stateName} ${zip}` || '';
}

return { addressStreet, cityStateZip, addressCountry };
Expand Down
Loading