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

Form 10215 Updates #33771

Merged
merged 9 commits into from
Dec 30, 2024
Merged
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
3 changes: 3 additions & 0 deletions src/applications/edu-benefits/10215/config/form.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';

Check warning on line 1 in src/applications/edu-benefits/10215/config/form.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 { arrayBuilderPages } from '~/platform/forms-system/src/js/patterns/array-builder';
import commonDefinitions from 'vets-json-schema/dist/definitions.json';
import manifest from '../manifest.json';
Expand Down Expand Up @@ -46,6 +46,9 @@
saveInProgress: {},
version: 0,
prefillEnabled: true,
customText: {
submitButtonText: 'Continue',
},
savedFormMessages: {
notFound: 'Please start over to apply for new form benefits.',
noAuth:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

Check warning on line 1 in src/applications/edu-benefits/10215/containers/ConfirmationPage.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.
import PropTypes from 'prop-types';
import { connect, useSelector } from 'react-redux';
import { useSelector } from 'react-redux';
import { ConfirmationView } from 'platform/forms-system/src/js/components/ConfirmationView';

const childContent = (
Expand Down Expand Up @@ -54,6 +54,7 @@
<va-button
secondary
text="Print this page"
data-testid="print-page"
onClick={() => window.print()}
/>
</p>
Expand All @@ -75,7 +76,7 @@
);

export const ConfirmationPage = props => {
const form = useSelector(state => state.form || {});
const form = useSelector(state => state?.form);
const { submission } = form;

const submitDate = submission.timestamp;
Expand Down Expand Up @@ -113,10 +114,4 @@
route: PropTypes.object,
};

function mapStateToProps(state) {
return {
form: state.form,
};
}

export default connect(mapStateToProps)(ConfirmationPage);
export default ConfirmationPage;
90 changes: 78 additions & 12 deletions src/applications/edu-benefits/10215/pages/calcs.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,84 @@
import React from 'react';
import React, { useEffect, useState } from 'react';

Check warning on line 1 in src/applications/edu-benefits/10215/pages/calcs.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 PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { querySelectorWithShadowRoot } from 'platform/utilities/ui/webComponents';
import { getFTECalcs } from '../helpers';

const Calcs = ({ data }) => {
const programIdx = window.location.href.split('?')[0].slice(-1);
const program = data.programs?.[programIdx];
const { supported, nonSupported, total, supportedFTEPercent } = getFTECalcs(
program,
);
const [programData, setProgramData] = useState(null);
//
// Form data in redux not updated promptly when inputting data in edit mode hence the following code is necessary at present rather than relying on state.form.data
//
async function updateData() {
const supportedInput = await querySelectorWithShadowRoot(
'va-text-input[name="root_fte_supported"]',
document,
);
const supportedInputValue = supportedInput?.shadowRoot.querySelector(
'input',
).value;
const nonSupportedInput = await querySelectorWithShadowRoot(
'va-text-input[name="root_fte_nonSupported"]',
document,
);
const nonSupportedInputValue = nonSupportedInput?.shadowRoot.querySelector(
'input',
).value;
const fteData = {
fte: {
supported: supportedInputValue,
nonSupported: nonSupportedInputValue,
},
};
if (fteData !== programData) setProgramData(getFTECalcs(fteData));
}

useEffect(() => {
let supportedInput;
let nonSupportedInput;

async function getInputs() {
supportedInput = await querySelectorWithShadowRoot(
'va-text-input[name="root_fte_supported"]',
document,
);
supportedInput = supportedInput?.shadowRoot?.querySelector('input');
nonSupportedInput = await querySelectorWithShadowRoot(
'va-text-input[name="root_fte_nonSupported"]',
document,
);
nonSupportedInput = nonSupportedInput?.shadowRoot?.querySelector('input');
supportedInput?.addEventListener('change', updateData);
nonSupportedInput?.addEventListener('change', updateData);
}

if (!programData && data) {
const programIdx = window.location.href.split('?')[0].slice(-1);
const program = data.programs?.[programIdx];
setProgramData(getFTECalcs(program));
}

getInputs();

return function cleanup() {
supportedInput.removeEventListener('change', updateData);
nonSupportedInput.removeEventListener('change', updateData);
};
}, []);

Check warning on line 67 in src/applications/edu-benefits/10215/pages/calcs.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/edu-benefits/10215/pages/calcs.js:67:6:React Hook useEffect has missing dependencies: 'data', 'programData', and 'updateData'. Either include them or remove the dependency array.

return (
<>
<div className="vads-u-margin-bottom--1">
<label className="vads-u-margin-bottom--1">Total Enrolled FTE</label>
<span className="vads-u-font-size--h3 vads-u-font-weight--bold">
{supported || nonSupported ? total : '--'}
<label className="vads-u-margin-bottom--1" data-testid="num-fte">

Check warning on line 72 in src/applications/edu-benefits/10215/pages/calcs.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/edu-benefits/10215/pages/calcs.js:72:9:A form label must be associated with a control.
Total Enrolled FTE
</label>
<span
className="vads-u-font-size--h3 vads-u-font-weight--bold"
data-testid="nonSupported"
>
{programData?.supported || programData?.nonSupported
? programData?.total
: '--'}
</span>
</div>
<va-additional-info trigger="How is Total enrolled FTE calculated?">
Expand All @@ -30,11 +93,14 @@
</p>
</va-additional-info>
<div className="vads-u-margin-bottom--1">
<label className="vads-u-margin-bottom--1">
<label className="vads-u-margin-bottom--1" data-testid="percentage-FTE">

Check warning on line 96 in src/applications/edu-benefits/10215/pages/calcs.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/edu-benefits/10215/pages/calcs.js:96:9:A form label must be associated with a control.
Supported student percentage FTE
</label>
<span className="vads-u-font-size--h3 vads-u-font-weight--bold">
{supportedFTEPercent || '--%'}
<span
className="vads-u-font-size--h3 vads-u-font-weight--bold"
data-testid="supportedFTEPercent"
>
{programData?.supportedFTEPercent || '--%'}
</span>
</div>
<va-additional-info trigger="How is Supported student percentage FTE calculated?">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';

Check warning on line 1 in src/applications/edu-benefits/10215/pages/program-intro.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 {
descriptionUI,
titleUI,
Expand All @@ -13,7 +13,7 @@
On the next several pages, you will provide all 85/15 calculations for
your institution. Submit calculations for all approved programs listed
on your most recent WEAMS-22-1998 Report. List every program and
iclude calculations, even if a program has a Supported Student or
include calculations, even if a program has a Supported Student or
Total Enrollment of "0".
</p>
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';

Check warning on line 1 in src/applications/edu-benefits/10215/tests/containers/ConfirmationPage.unit.spec.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.
import { expect } from 'chai';
import sinon from 'sinon';
import { Provider } from 'react-redux';
import { render } from '@testing-library/react';
import { fireEvent, render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { ConfirmationPage } from '../../containers/ConfirmationPage';
import ConfirmationPage from '../../containers/ConfirmationPage';

const storeBase = {
form: {
Expand Down Expand Up @@ -35,4 +36,16 @@
);
expect(container).to.exist;
});
it('should print the page', () => {
const printSpy = sinon.spy(window, 'print');
const { getByTestId } = render(
<Provider store={mockStore(storeBase)}>
<ConfirmationPage />
</Provider>,
);
expect(getByTestId('print-page')).to.exist;
fireEvent.click(getByTestId('print-page'));
expect(printSpy.calledOnce).to.be.true;
printSpy.restore();
});
});
Loading
Loading