From c9a722657c2f9cc321528b8c1da851c62ed95bbd Mon Sep 17 00:00:00 2001 From: Taras Kurilo Date: Tue, 5 Nov 2024 17:50:24 -0500 Subject: [PATCH] edm-290 remove enrollment history (#32898) * edm-290 remove enrollment history * updated cypress test --- .../components/EnrollmentHistory.jsx | 49 -------- .../components/EnrollmentPeriod.jsx | 114 ------------------ .../containers/StatusPage.jsx | 2 - .../tests/01-authed.cypress.spec.js | 5 - .../EnrollmentHistory.unit.spec.jsx | 98 --------------- .../components/EnrollmentPeriod.unit.spec.jsx | 83 ------------- .../post-911-gib-status/utils/helpers.jsx | 42 +------ 7 files changed, 1 insertion(+), 392 deletions(-) delete mode 100644 src/applications/post-911-gib-status/components/EnrollmentHistory.jsx delete mode 100644 src/applications/post-911-gib-status/components/EnrollmentPeriod.jsx delete mode 100644 src/applications/post-911-gib-status/tests/components/EnrollmentHistory.unit.spec.jsx delete mode 100644 src/applications/post-911-gib-status/tests/components/EnrollmentPeriod.unit.spec.jsx diff --git a/src/applications/post-911-gib-status/components/EnrollmentHistory.jsx b/src/applications/post-911-gib-status/components/EnrollmentHistory.jsx deleted file mode 100644 index 7de1261d718e..000000000000 --- a/src/applications/post-911-gib-status/components/EnrollmentHistory.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -import { enrollmentHistoryExplanation } from '../utils/helpers.jsx'; - -import EnrollmentPeriod from './EnrollmentPeriod'; - -function EnrollmentHistory({ enrollmentData = {} }) { - const enrollments = enrollmentData.enrollments || []; - - // History explanation box - let historyExplanationBox; - const noEnrollmentHistory = - enrollmentData.usedEntitlement?.months === 0 && - enrollmentData.usedEntitlement?.days === 0; - - if (noEnrollmentHistory) { - historyExplanationBox = enrollmentHistoryExplanation.noEnrollmentHistory; - } else { - historyExplanationBox = enrollmentHistoryExplanation.standard; - } - - // Render enrollment periods - const enrollmentHistory = enrollments.map((enrollment, index) => { - const indexKey = `enrollment-${index}`; - return ( - - ); - }); - - let sectionContent; - if (enrollmentData.veteranIsEligible) { - sectionContent = ( -
-

Enrollment History

- {historyExplanationBox} - {enrollmentHistory} -
- ); - } - - return
{sectionContent}
; -} - -EnrollmentHistory.propTypes = { - enrollmentData: PropTypes.object, -}; - -export default EnrollmentHistory; diff --git a/src/applications/post-911-gib-status/components/EnrollmentPeriod.jsx b/src/applications/post-911-gib-status/components/EnrollmentPeriod.jsx deleted file mode 100644 index 14d49e075427..000000000000 --- a/src/applications/post-911-gib-status/components/EnrollmentPeriod.jsx +++ /dev/null @@ -1,114 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -import InfoPair from './InfoPair'; - -import { formatDateParsedZoneShort } from 'platform/utilities/date'; -import { getScrollOptions } from 'platform/utilities/ui'; -import scrollTo from 'platform/utilities/ui/scrollTo'; - -class EnrollmentPeriod extends React.Component { - constructor() { - super(); - this.scrollToEnrollment = this.scrollToEnrollment.bind(this); - this.toggleHistory = this.toggleHistory.bind(this); - this.state = { historyExpanded: false }; - } - - scrollToEnrollment() { - const options = getScrollOptions({ - duration: 500, - delay: 2, - smooth: true, - }); - scrollTo(this.props.id, options); - } - - toggleHistory() { - const shouldExpand = !this.state.historyExpanded; - this.setState({ historyExpanded: !this.state.historyExpanded }); - if (shouldExpand) { - this.scrollToEnrollment(); - } - } - - render() { - const { enrollment, id } = this.props; - const amendments = enrollment.amendments || []; - const yellowRibbonStatus = enrollment.yellowRibbonAmount > 0 && ( -
- This is a Yellow Ribbon School.{' '} - - Learn more about the Yellow Ribbon Program. - -
- ); - - const changes = this.state.historyExpanded ? ( -
- {amendments.map((amendment, index) => ( -
- {index > 0 ?
: null} - - - - -
- ))} -
- ) : null; - - const changeHistory = - amendments.length > 0 ? ( -
- {/* eslint-disable-next-line jsx-a11y/no-redundant-roles */} -
    -
  • -
    - -
    -
    {changes}
    -
  • -
-
- ) : null; - - return ( -
-

- {formatDateParsedZoneShort(enrollment.beginDate)} to{' '} - {formatDateParsedZoneShort(enrollment.endDate)} at{' '} - - {(enrollment.facilityName || '').toLowerCase()} - {' '} - ({enrollment.facilityCode}) -

- {yellowRibbonStatus} - - - {changeHistory} -
-
- ); - } -} - -EnrollmentPeriod.propTypes = { - id: PropTypes.string, - enrollment: PropTypes.object, -}; - -export default EnrollmentPeriod; diff --git a/src/applications/post-911-gib-status/containers/StatusPage.jsx b/src/applications/post-911-gib-status/containers/StatusPage.jsx index 68e1c685c577..1e670fa6465e 100644 --- a/src/applications/post-911-gib-status/containers/StatusPage.jsx +++ b/src/applications/post-911-gib-status/containers/StatusPage.jsx @@ -9,7 +9,6 @@ import { VaTelephone, } from '@department-of-veterans-affairs/component-library/dist/react-bindings'; -import EnrollmentHistory from '../components/EnrollmentHistory'; import UserInfoSection from '../components/UserInfoSection'; class StatusPage extends React.Component { @@ -66,7 +65,6 @@ class StatusPage extends React.Component { . -

diff --git a/src/applications/post-911-gib-status/tests/01-authed.cypress.spec.js b/src/applications/post-911-gib-status/tests/01-authed.cypress.spec.js index 8ae23e2994eb..428c61b2334f 100644 --- a/src/applications/post-911-gib-status/tests/01-authed.cypress.spec.js +++ b/src/applications/post-911-gib-status/tests/01-authed.cypress.spec.js @@ -26,11 +26,6 @@ describe('Gibs Test', () => { cy.get('#gibs-full-name').should('contain', 'First Last'); - cy.get('#enrollment-0 h4').should( - 'contain', - '11/01/2012 to 12/01/2012 at purdue university', - ); - cy.get('#print-button').click(); cy.get('.print-status', { timeout: Timeouts.slow }).should('be.visible'); cy.injectAxeThenAxeCheck(); diff --git a/src/applications/post-911-gib-status/tests/components/EnrollmentHistory.unit.spec.jsx b/src/applications/post-911-gib-status/tests/components/EnrollmentHistory.unit.spec.jsx deleted file mode 100644 index 794004cb754c..000000000000 --- a/src/applications/post-911-gib-status/tests/components/EnrollmentHistory.unit.spec.jsx +++ /dev/null @@ -1,98 +0,0 @@ -import React from 'react'; -import SkinDeep from 'skin-deep'; -import { expect } from 'chai'; - -import EnrollmentHistory from '../../components/EnrollmentHistory'; - -const defaultProps = { - enrollmentData: { - veteranIsEligible: true, - firstName: 'Joe', - lastName: 'West', - dateOfBirth: '1995-11-12T06:00:00.000+0000', - vaFileNumber: '12345678', - regionalProcessingOffice: 'Central Office Washington, DC', - eligibilityDate: '2016-12-01T05:00:00.000+0000', - delimitingDate: '2017-12-07T05:00:00.000+0000', - percentageBenefit: 100, - originalEntitlement: { months: 36, days: 0 }, - usedEntitlement: { months: 3, days: 15 }, - remainingEntitlement: { months: 32, days: 15 }, - enrollments: [ - { - beginDate: '2012-11-01T04:00:00.000+0000', - endDate: '2012-12-01T05:00:00.000+0000', - facilityCode: '11902614', - facilityName: 'PURDUE UNIVERSITY', - fullTimeHours: 12, - onlineHours: 6, - onCampusHours: 6, - trainingType: 'UnderGrad', - yellowRibbonAmount: 0, - }, - ], - }, -}; - -describe('', () => { - it('should render', () => { - const tree = SkinDeep.shallowRender( - , - ); - const vdom = tree.getRenderOutput(); - expect(vdom).to.exist; - }); - - it('should show enrollments if veteran is eligible', () => { - const tree = SkinDeep.shallowRender( - , - ); - expect(tree.subTree('EnrollmentPeriod')).to.exist; - expect(tree.dive(['.section-header']).text()).to.equal( - 'Enrollment History', - ); - }); - - it('should not show enrollments if veteran is not eligible', () => { - const props = { - enrollmentData: { - veteranIsEligible: false, - percentageBenefit: 100, - originalEntitlement: { months: 36, days: 0 }, - usedEntitlement: { months: 36, days: 0 }, - remainingEntitlement: { months: 0, days: 0 }, - enrollments: [], - }, - }; - const tree = SkinDeep.shallowRender(); - expect(tree.subTree('EnrollmentPeriod')).to.be.false; - expect(tree.subTree('.section-header')).to.be.false; - }); - - it('should show history may be incorrect warning', () => { - const tree = SkinDeep.shallowRender( - , - ); - const featureBoxes = tree.dive(['.feature-box']).everySubTree('h4'); - expect(featureBoxes[0].text()).to.equal( - 'Does something look wrong in your enrollment history?', - ); - }); - - it('should show no enrollment history warning', () => { - const props = { - enrollmentData: { - veteranIsEligible: true, - originalEntitlement: { months: 3, days: 0 }, - usedEntitlement: { months: 0, days: 0 }, - remainingEntitlement: { months: 3, days: 0 }, - enrollments: [], - }, - }; - const tree = SkinDeep.shallowRender(); - const featureBoxes = tree.dive(['.feature-box']).everySubTree('h4'); - expect(featureBoxes[0].text()).to.equal( - 'You don’t have any enrollment history', - ); - }); -}); diff --git a/src/applications/post-911-gib-status/tests/components/EnrollmentPeriod.unit.spec.jsx b/src/applications/post-911-gib-status/tests/components/EnrollmentPeriod.unit.spec.jsx deleted file mode 100644 index a0d95c9ac8bd..000000000000 --- a/src/applications/post-911-gib-status/tests/components/EnrollmentPeriod.unit.spec.jsx +++ /dev/null @@ -1,83 +0,0 @@ -import React from 'react'; -import SkinDeep from 'skin-deep'; -import { expect } from 'chai'; -import _ from 'lodash'; - -import EnrollmentPeriod from '../../components/EnrollmentPeriod'; - -const defaultProps = { - id: 'abc', - enrollment: { - beginDate: '2016-01-06T17:01:03.925Z', - endDate: '2016-06-06T17:01:03.925Z', - facilityName: 'CENTRAL CITY UNIVERSITY', - facilityCode: '12123434', - onCampusHours: 10, - onlineHours: 2, - yellowRibbonAmount: 0, - amendments: [], - }, -}; - -const amendments = [ - { - onCampusHours: 12, - onlineHours: 2, - type: 'Add', - changeEffectiveDate: '2017-02-06T17:01:03.926Z', - yellowRibbonAmount: 2, - }, - { - onCampusHours: 12, - onlineHours: 0, - type: 'Drop', - changeEffectiveDate: '2017-03-06T17:01:03.926Z', - yellowRibbonAmount: 2, - }, -]; - -describe('', () => { - it('should render', () => { - const tree = SkinDeep.shallowRender(); - const vdom = tree.getRenderOutput(); - expect(vdom).to.exist; - }); - - it('should display enrollment data', () => { - const tree = SkinDeep.shallowRender(); - // Capitalization is taken care of by css styling - expect(tree.subTree('.facility').text()).to.contain( - 'central city university', - ); - }); - - it('should not show change history there are no amendments', () => { - const tree = SkinDeep.shallowRender(); - expect(tree.subTree('.usa-accordion')).to.be.false; - }); - - it('should show change history if there are amendments', () => { - const props = _.merge({}, defaultProps, { enrollment: { amendments } }); - const tree = SkinDeep.shallowRender(); - expect(tree.subTree('.usa-accordion')).not.to.be.false; - }); - - it('should not show change history contents when panel is collapsed', () => { - const props = _.merge({}, defaultProps, { enrollment: { amendments } }); - const tree = SkinDeep.shallowRender(); - expect(tree.subTree('.usa-accordion-content')).to.be.false; - }); - - it('should show or hide change history contents when panel is expanded or collapsed', () => { - const props = _.merge({}, defaultProps, { enrollment: { amendments } }); - const tree = SkinDeep.shallowRender(); - - // Expand - tree.getMountedInstance().toggleHistory(); - expect(tree.subTree('.usa-accordion-content')).not.to.be.false; - - // Collapse - tree.getMountedInstance().toggleHistory(); - expect(tree.subTree('.usa-accordion-content')).to.be.false; - }); -}); diff --git a/src/applications/post-911-gib-status/utils/helpers.jsx b/src/applications/post-911-gib-status/utils/helpers.jsx index 099a13ce4df8..a797dde05779 100644 --- a/src/applications/post-911-gib-status/utils/helpers.jsx +++ b/src/applications/post-911-gib-status/utils/helpers.jsx @@ -2,10 +2,7 @@ import React from 'react'; import { Link } from 'react-router'; import moment from 'moment'; -import { - VaAlert, - VaSummaryBox, -} from '@department-of-veterans-affairs/component-library/dist/react-bindings'; +import { VaAlert } from '@department-of-veterans-affairs/component-library/dist/react-bindings'; import { formatDateParsedZoneLong } from '@department-of-veterans-affairs/platform-utilities/date'; @@ -43,43 +40,6 @@ export function formatMonthDayFields(field) { return `${monthString}, ${dayString}`; } -export const enrollmentHistoryExplanation = { - standard: ( - -

- Does something look wrong in your enrollment history? -

-

Certain enrollments may not be displayed in this history if:

-
    -
  • - Your school made a request to us that’s still in process,{' '} - or -
  • -
  • - You made a request to us that’s still in process, or -
  • -
  • - You used or are using your benefit for flight, on-the-job, - apprenticeship, or correspondence training -
  • -
- - ), - noEnrollmentHistory: ( - -

You don’t have any enrollment history

-

Your enrollment history may not be available if:

-
    -
  • - You or your school did not yet make a request to us,{' '} - or -
  • -
  • You or your school made a request that’s still in process
  • -
-
- ), -}; - export function benefitEndDateExplanation(condition, delimitingDate) { switch (condition) { case 'activeDuty':