Skip to content

Commit

Permalink
Merge branch 'main' into update-comp-lib-37-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew565 committed Mar 1, 2024
2 parents ce455e1 + a49cd67 commit bc08634
Show file tree
Hide file tree
Showing 57 changed files with 1,091 additions and 649 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { SELECTED } from '../../../shared/constants';
import { getRandomDate } from '../../../shared/tests/cypress.helpers';

const getData = ({
showNod = true,
part3 = true,
isLoading = false,
loggedIn = true,
Expand All @@ -34,7 +33,6 @@ const getData = ({
} = {}) => ({
props: {
loggedIn,
showNod,
location: { pathname: '/introduction', search: '' },
children: <h1>Intro</h1>,
// formData,
Expand All @@ -44,7 +42,6 @@ const getData = ({
featureToggles: {
loading: isLoading,
/* eslint-disable camelcase */
form10182_nod: showNod,
nod_part3_update: part3,
/* eslint-enable camelcase */
},
Expand Down Expand Up @@ -265,7 +262,7 @@ describe('FormApp', () => {
const store = mockStore({
...data,
/* eslint-disable camelcase */
featureToggles: { form10182_nod: true, nod_part3_update: true },
featureToggles: { nod_part3_update: true },
/* eslint-enable camelcase */
});
render(
Expand Down
22 changes: 0 additions & 22 deletions src/applications/appeals/995/components/WIP.jsx

This file was deleted.

22 changes: 1 addition & 21 deletions src/applications/appeals/995/containers/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { isLoggedIn } from 'platform/user/selectors';

import { setData } from 'platform/forms-system/src/js/actions';
import { getStoredSubTask } from 'platform/forms/sub-task';
import { toggleValues } from 'platform/site-wide/feature-toggles/selectors';
import FEATURE_FLAG_NAMES from 'platform/utilities/feature-toggles/featureFlagNames';

import {
getContestableIssues as getContestableIssuesAction,
Expand All @@ -24,7 +22,6 @@ import {
} from '../utils/evidence';

import ITFWrapper from './ITFWrapper';
import { WIP } from '../components/WIP';
import {
DATA_DOG_ID,
DATA_DOG_TOKEN,
Expand All @@ -49,10 +46,8 @@ export const App = ({
getContestableIssues,
contestableIssues,
legacyCount,
isLoadingFeatures,
accountUuid,
inProgressFormId,
show995,
}) => {
// Make sure we're only loading issues once - see
// https://github.com/department-of-veterans-affairs/va.gov-team/issues/33931
Expand All @@ -75,10 +70,7 @@ export const App = ({

useEffect(
() => {
if (
show995 &&
SUPPORTED_BENEFIT_TYPES_LIST.includes(subTaskBenefitType)
) {
if (SUPPORTED_BENEFIT_TYPES_LIST.includes(subTaskBenefitType)) {
// form data is reset after logging in and from the save-in-progress data,
// so get it from the session storage
if (!formData.benefitType) {
Expand Down Expand Up @@ -123,7 +115,6 @@ export const App = ({

setFormData,
subTaskBenefitType,
show995,
],
);

Expand Down Expand Up @@ -162,13 +153,6 @@ export const App = ({
service: DATA_DOG_SERVICE,
});

if (isLoadingFeatures) {
return wrapInH1(<va-loading-indicator message="Loading application..." />);
}
if (!show995) {
return <WIP />;
}

if (!SUPPORTED_BENEFIT_TYPES_LIST.includes(subTaskBenefitType)) {
router.push('/start');
content = wrapInH1(
Expand Down Expand Up @@ -212,7 +196,6 @@ App.propTypes = {
legacyCount: PropTypes.number,
}),
inProgressFormId: PropTypes.number,
isLoadingFeatures: PropTypes.bool,
legacyCount: PropTypes.number,
location: PropTypes.shape({
pathname: PropTypes.string,
Expand All @@ -225,7 +208,6 @@ App.propTypes = {
push: PropTypes.func,
}),
savedForms: PropTypes.array,
show995: PropTypes.bool,
testSetTag: PropTypes.func,
};

Expand All @@ -237,8 +219,6 @@ const mapStateToProps = state => ({
savedForms: state.user?.profile?.savedForms || [],
contestableIssues: state.contestableIssues || {},
legacyCount: state.legacyCount || 0,
isLoadingFeatures: toggleValues(state).loading,
show995: toggleValues(state)[FEATURE_FLAG_NAMES.supplementalClaim] || false,
});

const mapDispatchToProps = {
Expand Down
31 changes: 3 additions & 28 deletions src/applications/appeals/995/subtask/SubTaskContainer.jsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,20 @@
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';

import FormFooter from 'platform/forms/components/FormFooter';
import SubTask from 'platform/forms/sub-task';
import { toggleValues } from 'platform/site-wide/feature-toggles/selectors';
import FEATURE_FLAG_NAMES from 'platform/utilities/feature-toggles/featureFlagNames';

import pages from './pages';
import formConfig from '../config/form';
import { WIP } from '../components/WIP';

export const SubTaskContainer = ({ show995, isLoadingFeatures }) => {
if (isLoadingFeatures) {
return (
<h1 className="vads-u-font-family--sans vads-u-font-size--base vads-u-font-weight--normal vads-u-margin-bottom--4">
<va-loading-indicator message="Loading application..." />
</h1>
);
}

return show995 ? (
export const SubTaskContainer = () => {
return (
<article data-page="start" className="row">
<div className="usa-width-two-thirds medium-8 columns vads-u-margin-bottom--2">
<SubTask pages={pages} />
</div>
<FormFooter formConfig={formConfig} />
</article>
) : (
<WIP />
);
};

SubTaskContainer.propTypes = {
isLoadingFeatures: PropTypes.bool,
show995: PropTypes.bool,
};

const mapStateToProps = state => ({
isLoadingFeatures: toggleValues(state).loading,
show995: toggleValues(state)[FEATURE_FLAG_NAMES.supplementalClaim] || false,
});

export default connect(mapStateToProps)(SubTaskContainer);
export default SubTaskContainer;
33 changes: 0 additions & 33 deletions src/applications/appeals/995/tests/containers/App.unit.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ const hasComp = { benefitType: 'compensation' };
const getData = ({
loggedIn = true,
savedForms = [],
loading = false,
verified = true,
show995 = true,
data = hasComp,
accountUuid = '',
push = () => {},
Expand Down Expand Up @@ -55,11 +53,6 @@ const getData = ({
},
data,
},
featureToggles: {
loading,
// eslint-disable-next-line camelcase
supplemental_claim: show995,
},
contestableIssues: {
status: '',
},
Expand Down Expand Up @@ -101,32 +94,6 @@ describe('App', () => {
expect($('va-loading-indicator', container)).to.not.exist;
});

it('should show feature toggles loading indicator', () => {
const { props, data } = getData({ loading: true });
const { container } = render(
<Provider store={mockStore(data)}>
<App {...props} />
</Provider>,
);

expect(
$('va-loading-indicator', container).getAttribute('message'),
).to.contain('Loading application');
});

it('should show WIP alert when feature is disabled', () => {
const { props, data } = getData({ show995: false });
const { container } = render(
<Provider store={mockStore(data)}>
<App {...props} />
</Provider>,
);

const alert = $('va-alert', container);
expect(alert).to.exist;
expect(alert.innerHTML).to.contain('still working on this feature');
});

it('should show contestable issue loading indicator', () => {
const { props, data } = getData();
const { container } = render(
Expand Down
28 changes: 1 addition & 27 deletions src/applications/appeals/995/tests/subtask/subtask.unit.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import SubTask, {
import SubTaskContainer from '../../subtask/SubTaskContainer';
import pages from '../../subtask/pages';

const mockStore = ({ data = {}, show995 = true, loading = false } = {}) => {
const mockStore = ({ data = {} } = {}) => {
setStoredSubTask(data);
return {
getState: () => ({
Expand All @@ -26,11 +26,6 @@ const mockStore = ({ data = {}, show995 = true, loading = false } = {}) => {
touched: {},
submitted: false,
},
featureToggles: {
loading,
// eslint-disable-next-line camelcase
supplemental_claim: show995,
},
}),
subscribe: () => {},
dispatch: () => ({
Expand All @@ -44,27 +39,6 @@ describe('the Supplemental Claims Sub-task', () => {
resetStoredSubTask();
});

it('should render feature toggle loading indicator', () => {
const { container } = render(
<Provider store={mockStore({ loading: true })}>
<SubTaskContainer />
</Provider>,
);
expect(
$('va-loading-indicator', container).getAttribute('message'),
).to.contain('Loading application');
});
it('should render WIP alert', () => {
const { container } = render(
<Provider store={mockStore({ show995: false })}>
<SubTaskContainer />
</Provider>,
);
const alert = $('va-alert', container);
expect(alert).to.exist;
expect(alert.innerHTML).to.contain('still working on this feature');
});

it('should render the SubTask as a form element', () => {
const { container } = render(
<Provider store={mockStore()}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@
"data": {
"type": "feature_toggles",
"features": [{
"name": "form10182_nod",
"value": true
}, {
"name": "nod_part3_update",
"value": true
},

{
"name": "supplemental_claim",
"value": true
}]
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import React from 'react';
import { checkboxGroupSchema } from 'platform/forms-system/src/js/web-component-patterns';
import {
capitalizeEachWord,
isClaimingNew,
showToxicExposurePages,
sippableId,
} from '../utils';
import { NULL_CONDITION_STRING } from '../constants';
import { capitalizeEachWord, isClaimingNew, sippableId } from '../utils';
import { NULL_CONDITION_STRING, SHOW_TOXIC_EXPOSURE } from '../constants';

/**
* Checks if the toxic exposure pages should be displayed. Note: toggle is currently read
* from the redux store by Form526EZApp and stored in sessions storage since not all form
* aspects have ready access to the store.
* @returns true if the toggle is enabled and Veteran is claiming at least one new condition, false otherwise
*/
export const showToxicExposurePages = formData =>
window.sessionStorage.getItem(SHOW_TOXIC_EXPOSURE) === 'true' &&
formData?.newDisabilities?.length > 0;

/**
* Checks if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import {
conditionsPageTitle,
gulfWar1990PageTitle,
isClaimingTECondition,
showToxicExposurePages,
} from '../../content/toxicExposure';
import { isClaimingNew, showToxicExposurePages } from '../../utils/index';
import { isClaimingNew } from '../../utils/index';

export const toxicExposurePages = {
toxicExposureConditions: {
title: conditionsPageTitle,
path: 'toxic-exposure-conditions',
depends: () => isClaimingNew && showToxicExposurePages,
depends: formData =>
isClaimingNew(formData) && showToxicExposurePages(formData),
uiSchema: toxicExposureConditions.uiSchema,
schema: toxicExposureConditions.schema,
},
Expand Down

0 comments on commit bc08634

Please sign in to comment.