-
Notifications
You must be signed in to change notification settings - Fork 19
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
Added Story for AddressMotionToVacateView
#14777
Changes from all commits
aef8f09
695488b
d37d602
2512434
e3ccc16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
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, | ||
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: { | ||
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) => ( | ||
<StaticRouter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a chance that using |
||
location={{ | ||
pathname: `/queue/appeals/${appealId}/tasks/1/${ | ||
TASK_ACTIONS.ADDRESS_MOTION_TO_VACATE.value | ||
}`, | ||
}} | ||
> | ||
<Route | ||
path={`/queue/appeals/:appealId/tasks/:taskId/${ | ||
TASK_ACTIONS.ADDRESS_MOTION_TO_VACATE.value | ||
}`} | ||
> | ||
{storyFn()} | ||
</Route> | ||
</StaticRouter> | ||
); | ||
|
||
const ReduxDecorator = (storyFn) => ( | ||
<ReduxBase | ||
reducer={queueReducer} | ||
initialState={{ queue: { ...initialState, ...storyState } }} | ||
> | ||
{storyFn()} | ||
</ReduxBase> | ||
); | ||
|
||
export default { | ||
title: | ||
'Queue/Motions to Vacate/Judge Address Motion to Vacate/AddressMotionToVacateView', | ||
component: AddressMotionToVacateView, | ||
decorators: [RouterDecorator, ReduxDecorator], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can specify as many decorators as you want. Each will simply wrap the next. |
||
}; | ||
|
||
const Template = () => <AddressMotionToVacateView />; | ||
|
||
export const Basic = Template.bind({}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This (setting up a template once and then basing all stories off of it) is the recommended syntax for stories in Storybook 6.x. While it isn't particularly useful in a case with only a single story, I used it here for example purposes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept this seed data to the bare minimum necessary to render the component in the story. This should properly contain the whole task tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be some seed data missing, I'm getting an error for the partial grant option (will upload a screenshot on the PR).