From aef8f092d7665862399e79d14a959c7ad2317746 Mon Sep 17 00:00:00 2001 From: JC Quirin Date: Mon, 27 Jul 2020 14:06:00 -0700 Subject: [PATCH 1/3] created a story for `AddressMotionToVacateView`: (shows how to use decorators for router & redux) --- .../mtv/AddressMotionToVacateView.stories.js | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 client/app/queue/mtv/AddressMotionToVacateView.stories.js diff --git a/client/app/queue/mtv/AddressMotionToVacateView.stories.js b/client/app/queue/mtv/AddressMotionToVacateView.stories.js new file mode 100644 index 00000000000..b67147efe55 --- /dev/null +++ b/client/app/queue/mtv/AddressMotionToVacateView.stories.js @@ -0,0 +1,87 @@ +import React from 'react'; + +import { v4 as uuidv4 } from 'uuid'; +import { StaticRouter, Route } from 'react-router-dom'; +import ReduxBase from '../../components/ReduxBase'; +import queueReducer, { initialState } from '../reducers'; + +import TASK_ACTIONS from '../../../constants/TASK_ACTIONS'; +import AddressMotionToVacateView from './AddressMotionToVacateView'; + +const appealId = uuidv4(); +const taskId = '1'; +const appeal = { + externalId: appealId, + veteranFullName: 'John Doe', + veteranFileNumber: '123456789', + veteranInfo: { + veteran: { + full_name: 'John Doe', + }, + }, +}; + +const storyState = { + appeals: { + [appealId]: appeal, + }, + appealDetails: { + [appealId]: appeal, + }, + amaTasks: { + [taskId]: { + uniqueId: taskId, + externalAppealId: appealId, + label: 'Address Motion to Vacate', + type: 'JudgeAddressMotionToVacateTask', + instructions: ['I think you should grant vacatur'], + availableActions: [ + { + label: 'Address Motion to Vacate', + value: 'address_motion_to_vacate', + data: { + options: [{ label: 'Jane Doe', value: 1 }], + }, + }, + ], + }, + }, +}; + +const RouterDecorator = (storyFn) => ( + + + {storyFn()} + + +); + +const ReduxDecorator = (storyFn) => ( + + {storyFn()} + +); + +export default { + title: + 'Queue/Motions to Vacate/Judge Address Motion to Vacate/AddressMotionToVacateView', + component: AddressMotionToVacateView, + decorators: [RouterDecorator, ReduxDecorator], +}; + +const Template = () => ; + +export const Basic = Template.bind({}); From 695488bd41c8c696bc5f560f831ba2b2ec924a32 Mon Sep 17 00:00:00 2001 From: JC Quirin Date: Wed, 29 Jul 2020 12:16:34 -0700 Subject: [PATCH 2/3] better handling of undefines in MTVIssueSelection --- client/app/queue/mtv/MTVIssueSelection.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/app/queue/mtv/MTVIssueSelection.jsx b/client/app/queue/mtv/MTVIssueSelection.jsx index 33f36a84f4c..d79e280c990 100644 --- a/client/app/queue/mtv/MTVIssueSelection.jsx +++ b/client/app/queue/mtv/MTVIssueSelection.jsx @@ -3,13 +3,13 @@ import PropTypes from 'prop-types'; import CheckboxGroup from '../../components/CheckboxGroup'; import { JUDGE_ADDRESS_MTV_ISSUE_SELECTION_LABEL } from '../../../COPY'; -const getDisplayOptions = (issues) => { +const getDisplayOptions = (issues = []) => { // CheckboxGroup expects options with id (string) & label return issues.map(({ id, description }, idx) => ({ id: id.toString(), label: `${idx + 1}. ${description}` })); }; -export const MTVIssueSelection = ({ issues, onChange }) => { +export const MTVIssueSelection = ({ issues = [], onChange }) => { const [selectedIssues, setSelectedIssues] = useState({}); useEffect(() => { From d37d602b1a81ac838a7b25940b24923a0333d93f Mon Sep 17 00:00:00 2001 From: JC Quirin Date: Wed, 29 Jul 2020 12:17:04 -0700 Subject: [PATCH 3/3] addtl seed data for AddressMotionToVacateView story (fixes issue when choosing partial grant disposition) --- .../mtv/AddressMotionToVacateView.stories.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/client/app/queue/mtv/AddressMotionToVacateView.stories.js b/client/app/queue/mtv/AddressMotionToVacateView.stories.js index b67147efe55..e89dc72f451 100644 --- a/client/app/queue/mtv/AddressMotionToVacateView.stories.js +++ b/client/app/queue/mtv/AddressMotionToVacateView.stories.js @@ -12,6 +12,26 @@ const appealId = uuidv4(); const taskId = '1'; const appeal = { externalId: appealId, + issues: [ + { id: 1, program: 'compensation', description: 'issue description' }, + { id: 2, program: 'compensation', description: 'issue description 2' }, + ], + decisionIssues: [ + { + id: 1, + disposition: 'allowed', + description: 'Decision issue 1', + benefit_type: 'compensation', + request_issue_ids: [1], + }, + { + id: 2, + disposition: 'allowed', + description: 'Decision issue 2', + benefit_type: 'compensation', + request_issue_ids: [2], + }, + ], veteranFullName: 'John Doe', veteranFileNumber: '123456789', veteranInfo: {