Skip to content

Commit

Permalink
Update Type of care section
Browse files Browse the repository at this point in the history
  • Loading branch information
JunTaoLuo committed Dec 27, 2024
1 parent a70bc73 commit 4f0d004
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FLOW_TYPES } from '../../../../utils/constants';
import { sentenceCase } from '../../../../utils/formatters';
import { getTypeOfCare } from '../../../redux/selectors';

export default function TypeOfAppointmentSection({ data, flowType }) {
const typeOfCare = getTypeOfCare(data)?.name;

let typeOfAppt = 'VA Appointment';

if (FLOW_TYPES.REQUEST === flowType) {
typeOfAppt = 'Type of care';

return (
<>
<h2 className="vads-u-font-size--h3 vads-u-margin-top--0">
{typeOfAppt}
</h2>
<span className="vads-u-font-size--sm vads-u-font-weight--normal vads-u-font-family--sans">
{typeOfCare}
</span>
</>
);
}
export default function TypeOfAppointmentSection({ data }) {
const typeOfCare = sentenceCase(getTypeOfCare(data)?.name);

return (
<>
<h2 className="vads-u-font-size--h3 vads-u-margin-top--0">
{typeOfAppt}
Type of care
</h2>
<span className="vaos-form__title vads-u-font-size--sm vads-u-font-weight--normal vads-u-font-family--sans">
<span className="vads-u-font-size--sm vads-u-font-weight--normal vads-u-font-family--sans">
{typeOfCare}
</span>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FACILITY_TYPES, FLOW_TYPES } from '../../../../utils/constants';
import { FACILITY_TYPES } from '../../../../utils/constants';
import TypeOfAppointmentSection from './TypeOfAppointmentSection';
import VAAppointmentSection from './VAAppointmentSection';
import CommunityCareSection from './CommunityCareSection/CommunityCareSection';
Expand All @@ -17,7 +17,7 @@ export default function ReviewRequestInfo({
return (
<div>
<h1 className="vaos-review__header vads-u-font-size--h2">{pageTitle}</h1>
<TypeOfAppointmentSection data={data} flowType={FLOW_TYPES.REQUEST} />
<TypeOfAppointmentSection data={data} />
<hr aria-hidden="true" className="vads-u-margin-y--2" />
{isCommunityCare && (
<CommunityCareSection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});

await screen.findByText(/scheduling a primary care appointment/i);
await screen.findByText('Primary care');
expect(screen.getByText('Primary care')).to.have.tagName('span');
const [
pageHeading,
descHeading,
typeOfCareHeading,
dateHeading,
clinicHeading,
Expand All @@ -130,10 +129,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
expect(pageHeading).to.contain.text(
'Review and confirm your appointment details',
);
expect(descHeading).to.contain.text(
'scheduling a primary care appointment',
);
expect(typeOfCareHeading).to.contain.text('VA Appointment');
expect(typeOfCareHeading).to.contain.text('Type of care');
expect(screen.baseElement).to.contain.text('Primary care');

expect(dateHeading).to.contain.text(
Expand Down Expand Up @@ -174,7 +170,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});

await screen.findByText(/scheduling a primary care appointment/i);
await screen.findByText('Primary care');

userEvent.click(screen.getByText(/Confirm appointment/i));
await waitFor(() => {
Expand Down Expand Up @@ -216,7 +212,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});

await screen.findByText(/scheduling a primary care appointment/i);
await screen.findByText('Primary care');

userEvent.click(screen.getByText(/Confirm appointment/i));

Expand Down Expand Up @@ -261,7 +257,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});

await screen.findByText(/scheduling a primary care appointment/i);
await screen.findByText('Primary care');

userEvent.click(screen.getByText(/Confirm appointment/i));

Expand Down Expand Up @@ -300,7 +296,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});

await screen.findByText(/scheduling a primary care appointment/i);
await screen.findByText('Primary care');

userEvent.click(screen.getByText(/Confirm appointment/i));

Expand Down Expand Up @@ -339,7 +335,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});

await screen.findByText(/scheduling a primary care appointment/i);
await screen.findByText('Primary care');

userEvent.click(screen.getByText(/Confirm appointment/i));

Expand Down

0 comments on commit 4f0d004

Please sign in to comment.