Skip to content

Commit

Permalink
Update document title on details pages (#32819)
Browse files Browse the repository at this point in the history
* Update document title

* Fix unit test
  • Loading branch information
jenniemc authored Oct 31, 2024
1 parent 672a26a commit baa1332
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,43 +67,28 @@ export default function ConfirmedAppointmentDetailsPage() {
useEffect(
() => {
let pageTitle = 'VA appointment on';
let prefix = null;
let prefix = 'Upcoming';

if (isPast) prefix = 'Past';
else if (selectIsCanceled(appointment)) prefix = 'Canceled';

if (isCommunityCare)
pageTitle = prefix
? `${prefix} community care appointment on`
: 'Community care appointment on';
else if (isInPerson) {
pageTitle = `${prefix} Community Care Appointment On`;
if (isInPerson) {
if (appointment?.vaos?.isCompAndPenAppointment)
pageTitle = prefix
? `${prefix} claim exam appointment on`
: 'Claim exam appointment on';
else
pageTitle = prefix
? `${prefix} in-person appointment on`
: 'In-person appointment on';
pageTitle = `${prefix} Claim Exam Appointment On`;
else pageTitle = `${prefix} In-person Appointment On`;
}
if (isVideo) {
pageTitle = prefix
? `${prefix} video appointment on`
: 'Video appointment on';
pageTitle = `${prefix} Video Appointment On`;
if (isClinicVideoAppointment(appointment)) {
pageTitle = prefix
? `${prefix} video appointment at a VA location on`
: 'Video appointment at a VA location on';
pageTitle = `${prefix} Video Appointment At A VA Location On`;
}
if (isAtlasVideoAppointment(appointment)) {
pageTitle = prefix
? `${prefix} video appointment at an ATLAS location on`
: 'Video appointment at an ATLAS location on';
pageTitle = `${prefix} Video Appointment At An ATLAS Location On`;
}
} else if (isVAPhoneAppointment(appointment)) {
pageTitle = prefix
? `${prefix} phone appointment on`
: 'Phone appointment on';
pageTitle = `${prefix} Phone Appointment On`;
}
const pageTitleSuffix = featureBreadcrumbUrlUpdate
? ' | Veterans Affairs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ export default function RequestedAppointmentDetailsPage() {
} ${typeOfCareText} appointment`;

if (featureBreadcrumbUrlUpdate) {
title = `${isCanceled ? 'Canceled request for' : 'Request for'}
${typeOfCareText} ${
isCC ? 'community care appointment' : 'appointment'
}`;
title = `${
isCanceled ? 'Canceled Request For' : 'Pending Request For'
}
${isCC ? 'Community Care Appointment' : 'Appointment'}`;
title = title.concat(` | Veterans Affairs`);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Video appointment at an ATLAS location on ${today.format(
`Upcoming Video Appointment At An ATLAS Location On ${today.format(
'dddd, MMMM D, YYYY',
)} | Veterans Affairs`,
);
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Past video appointment at an ATLAS location on ${yesterday.format(
`Past Video Appointment At An ATLAS Location On ${yesterday.format(
'dddd, MMMM D, YYYY',
)} | Veterans Affairs`,
);
Expand Down Expand Up @@ -233,7 +233,7 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Canceled video appointment at an ATLAS location on ${today.format(
`Canceled Video Appointment At An ATLAS Location On ${today.format(
'dddd, MMMM D, YYYY',
)} | Veterans Affairs`,
);
Expand Down Expand Up @@ -261,7 +261,7 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Video appointment on ${today.format(
`Upcoming Video Appointment On ${today.format(
'dddd, MMMM D, YYYY',
)} | Veterans Affairs`,
);
Expand Down Expand Up @@ -289,7 +289,7 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Past video appointment on ${yesterday.format(
`Past Video Appointment On ${yesterday.format(
'dddd, MMMM D, YYYY',
)} | Veterans Affairs`,
);
Expand Down Expand Up @@ -318,7 +318,7 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Canceled video appointment on ${today.format(
`Canceled Video Appointment On ${today.format(
'dddd, MMMM D, YYYY',
)} | Veterans Affairs`,
);
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Video appointment at a VA location on ${today.format(
`Upcoming Video Appointment At A VA Location On ${today.format(
'dddd, MMMM D, YYYY',
)} | Veterans Affairs`,
);
Expand Down Expand Up @@ -374,7 +374,7 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Past video appointment at a VA location on ${yesterday.format(
`Past Video Appointment At A VA Location On ${yesterday.format(
'dddd, MMMM D, YYYY',
)} | Veterans Affairs`,
);
Expand Down Expand Up @@ -403,7 +403,7 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Canceled video appointment at a VA location on ${today.format(
`Canceled Video Appointment At A VA Location On ${today.format(
'dddd, MMMM D, YYYY',
)} | Veterans Affairs`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('VAOS Page: RequestedAppointmentDetailsPage', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
'Request for primary care appointment | Veterans Affairs',
'Pending Request For Appointment | Veterans Affairs',
);
});
});
Expand All @@ -143,7 +143,7 @@ describe('VAOS Page: RequestedAppointmentDetailsPage', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
`Request for hearing aid support community care appointment | Veterans Affairs`,
`Pending Request For Community Care Appointment | Veterans Affairs`,
);
});
});
Expand All @@ -166,7 +166,7 @@ describe('VAOS Page: RequestedAppointmentDetailsPage', () => {
// Assert
await waitFor(() => {
expect(global.document.title).to.equal(
'Canceled request for primary care appointment | Veterans Affairs',
'Canceled Request For Appointment | Veterans Affairs',
);
});
});
Expand Down

0 comments on commit baa1332

Please sign in to comment.