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

DBEX 0781 consent page #33804

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import * as workflowChoicePage from '../../pages/form0781/workflowChoicePage';

Check warning on line 1 in src/applications/disability-benefits/all-claims/config/form0781/index.js

View workflow job for this annotation

GitHub Actions / App Isolation Annotations

Staged Continuous Deployment App Isolation Conflict

*WARNING* This PR contains changes related to an application that is currently not isolated. As of Feb 3, 2025 deployment may no longer be possible for apps that are not isolated. Please isolate this app from other directories in 'src/applications' to prevent future deployment issues. More information on your app's status can be seen here: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/frontend-support-dashboard/cross-app-import-report Please reach out to Frontend Platform Support with any questions.
import * as mentalHealthSupport from '../../pages/form0781/mentalHealthSupport';
import * as traumaticEventsIntro from '../../pages/form0781/traumaticEventsIntro';
import * as eventType from '../../pages/form0781/traumaticEventTypes';
import { showForm0781Pages, isCompletingForm0781 } from '../../utils/form0781';
import {
showForm0781Pages,
isCompletingForm0781,
isRelatedToMST,
} from '../../utils/form0781';
import * as consentPage from '../../pages/form0781/consentPage';
import * as additionalInformationPage from '../../pages/form0781/additionalInformationPage';

/**
* Configuration for our modern 0781 paper sync (2024/2025)
Expand Down Expand Up @@ -37,4 +43,16 @@
uiSchema: eventType.uiSchema,
schema: eventType.schema,
},
consentPage: {
path: 'additional-forms/mental-health-statement/consent',
depends: formData => isRelatedToMST(formData),
uiSchema: consentPage.uiSchema,
schema: consentPage.schema,
},
additionalInformationPage: {
path: 'additional-forms/mental-health-statement/additional-information',
depends: formData => showForm0781Pages(formData),
uiSchema: additionalInformationPage.uiSchema,
schema: additionalInformationPage.schema,
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from 'react';

Check warning on line 1 in src/applications/disability-benefits/all-claims/content/form0781/consentPage.jsx

View workflow job for this annotation

GitHub Actions / App Isolation Annotations

Staged Continuous Deployment App Isolation Conflict

*WARNING* This PR contains changes related to an application that is currently not isolated. As of Feb 3, 2025 deployment may no longer be possible for apps that are not isolated. Please isolate this app from other directories in 'src/applications' to prevent future deployment issues. More information on your app's status can be seen here: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/frontend-support-dashboard/cross-app-import-report Please reach out to Frontend Platform Support with any questions.

export const consentPageTitle =
'Option to add indicator of certain upcoming claim and appeal events to your VA medical record';

export const consentPageDescription = (
<>
<p>
If you’re enrolled or registered in VA health care and you’re filing a
claim related to military sexual trauma (MST), you have the option to
allow us to add an indicator (also known as a notification) to your VA
medical record when certain claim and appeal events are happening soon.
This indicator will only show that certain claim and appeal events are
happening soon. It won’t show any other details specific to your claim.
</p>
<p>
If you give us permission, we’ll note in your medical record when one of
these events happens:
</p>
<ul>
<li>
We’ve submitted a request to schedule a claim exam (also known as a
compensation and pension, or C&P, exam)
</li>
<li>We’ve made a decision on your claim</li>
<li>We’ve scheduled a hearing before the Board of Veterans’ Appeals</li>
</ul>
<p>
Your VA health care providers may review the indicator in your medical
record. The indicator won’t identify your claim as MST-related. But since
we only offer this option for MST-related claims, providers who review it
may know that your claim is related to MST.
</p>
<p>
You can always choose to tell a health care provider about these claim and
appeal events yourself, even if you don’t give us permission to add an
indicator to your medical record.
</p>
</>
);

export const consentPageFormQuestion =
'Do you give us permission to add an indicator about claim or appeal events to your VA medical record?';

export const consentPageFormHint =
'Your answer won’t affect the status or decision for your claim. If you skip this question, we won’t add an indicator to your VA medical record.';

export const CONSENT_OPTION_INDICATOR_CHOICES = Object.freeze({
yes: 'Yes',
no: 'No',
revoke:
'I gave permission in the past, but I want to revoke (or cancel) my permission.',
notEnrolled: 'I’m not enrolled or registered in VA health care.',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// TODO: this is a placeholder. Structure will be added to this page in this ticket #97085

Check warning on line 1 in src/applications/disability-benefits/all-claims/pages/form0781/additionalInformationPage.js

View workflow job for this annotation

GitHub Actions / App Isolation Annotations

Staged Continuous Deployment App Isolation Conflict

*WARNING* This PR contains changes related to an application that is currently not isolated. As of Feb 3, 2025 deployment may no longer be possible for apps that are not isolated. Please isolate this app from other directories in 'src/applications' to prevent future deployment issues. More information on your app's status can be seen here: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/frontend-support-dashboard/cross-app-import-report Please reach out to Frontend Platform Support with any questions.
export const uiSchema = {
'ui:description': 'Placeholder text for additional information page skeleton',
};

export const schema = {
type: 'object',
properties: {},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {

Check warning on line 1 in src/applications/disability-benefits/all-claims/pages/form0781/consentPage.js

View workflow job for this annotation

GitHub Actions / App Isolation Annotations

Staged Continuous Deployment App Isolation Conflict

*WARNING* This PR contains changes related to an application that is currently not isolated. As of Feb 3, 2025 deployment may no longer be possible for apps that are not isolated. Please isolate this app from other directories in 'src/applications' to prevent future deployment issues. More information on your app's status can be seen here: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/frontend-support-dashboard/cross-app-import-report Please reach out to Frontend Platform Support with any questions.
radioUI,
radioSchema,
} from 'platform/forms-system/src/js/web-component-patterns';
import {
consentPageDescription,
consentPageFormHint,
consentPageFormQuestion,
consentPageTitle,
CONSENT_OPTION_INDICATOR_CHOICES,
} from '../../content/form0781/consentPage';
import { formTitle } from '../../utils';

export const uiSchema = {
ajones446 marked this conversation as resolved.
Show resolved Hide resolved
'ui:title': formTitle(consentPageTitle),
'ui:description': consentPageDescription,
optionIndicator: radioUI({
title: consentPageFormQuestion,
labelHeaderLevel: '4',
hint: consentPageFormHint,
labels: CONSENT_OPTION_INDICATOR_CHOICES,
}),
};

export const schema = {
type: 'object',
properties: {
optionIndicator: radioSchema(Object.keys(CONSENT_OPTION_INDICATOR_CHOICES)),
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import React from 'react';

Check warning on line 1 in src/applications/disability-benefits/all-claims/tests/pages/form0781/consentPage.unit.spec.js

View workflow job for this annotation

GitHub Actions / App Isolation Annotations

Staged Continuous Deployment App Isolation Conflict

*WARNING* This PR contains changes related to an application that is currently not isolated. As of Feb 3, 2025 deployment may no longer be possible for apps that are not isolated. Please isolate this app from other directories in 'src/applications' to prevent future deployment issues. More information on your app's status can be seen here: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/frontend-support-dashboard/cross-app-import-report Please reach out to Frontend Platform Support with any questions.
import { expect } from 'chai';
import { fireEvent, render } from '@testing-library/react';
import { DefinitionTester } from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
import userEvent from '@testing-library/user-event';
import Sinon from 'sinon';
import {
$,
$$,
} from '@department-of-veterans-affairs/platform-forms-system/ui';
import * as consentPage from '../../../pages/form0781/consentPage';
import {
consentPageTitle,
CONSENT_OPTION_INDICATOR_CHOICES,
} from '../../../content/form0781/consentPage';

describe('Form 0781 consent page', () => {
const { schema, uiSchema } = consentPage;

it('should define a uiSchema object', () => {
expect(uiSchema).to.be.an('object');
});

it('should define a schema object', () => {
expect(schema).to.be.an('object');
});

it('Displays a radio button selection of choices for consenting to add an indicator', () => {
const onSubmit = Sinon.spy();
const { container, getByText } = render(
<DefinitionTester
schema={schema}
uiSchema={uiSchema}
data={{}}
definitions={{}}
formData={{}}
onSubmit={onSubmit}
/>,
);

getByText(consentPageTitle);

const radio = $('va-radio', container);
// Not required
expect(radio.getAttribute('required')).to.eq('false');

// Expect one question with four radio inputs
expect($$('va-radio').length).to.equal(1);
expect($$('va-radio-option').length).to.equal(
Object.keys(CONSENT_OPTION_INDICATOR_CHOICES).length,
);

// verify each checkbox exists with user facing label
Object.values(CONSENT_OPTION_INDICATOR_CHOICES).forEach(option => {
expect($$(`va-checkbox[label="${option}"]`, container)).to.exist;
});
});

it('should submit without selecting an option', () => {
const onSubmit = Sinon.spy();

const { getByText } = render(
<DefinitionTester
schema={schema}
uiSchema={uiSchema}
data={{}}
onSubmit={onSubmit}
/>,
);
userEvent.click(getByText('Submit'));
expect(onSubmit.calledOnce).to.be.true;
});

it('should submit if an option is selected', () => {
const onSubmit = Sinon.spy();

const { container } = render(
<DefinitionTester
schema={schema}
uiSchema={uiSchema}
data={{}}
onSubmit={onSubmit}
/>,
);

expect(
$('va-radio', container).__events.vaValueChange({
detail: { value: 'revoke' },
}),
);
fireEvent.submit($('form', container));
expect(onSubmit.called).to.be.true;
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// All flippers for the 0781 Papersync should be added to this file

Check warning on line 1 in src/applications/disability-benefits/all-claims/utils/form0781.js

View workflow job for this annotation

GitHub Actions / App Isolation Annotations

Staged Continuous Deployment App Isolation Conflict

*WARNING* This PR contains changes related to an application that is currently not isolated. As of Feb 3, 2025 deployment may no longer be possible for apps that are not isolated. Please isolate this app from other directories in 'src/applications' to prevent future deployment issues. More information on your app's status can be seen here: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/frontend-support-dashboard/cross-app-import-report Please reach out to Frontend Platform Support with any questions.
import { isClaimingNew } from '.';
import { form0781WorkflowChoices } from '../content/form0781';

Expand Down Expand Up @@ -40,3 +40,10 @@
form0781WorkflowChoices.COMPLETE_ONLINE_FORM
);
}

export function isRelatedToMST(formData) {
return (
isCompletingForm0781(formData) &&
formData.mentalHealth.eventTypes.mst === true
ajones446 marked this conversation as resolved.
Show resolved Hide resolved
);
}
Loading