-
Notifications
You must be signed in to change notification settings - Fork 35
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
MB-4638 Storybook allowances viewer form authorized weight #5439
MB-4638 Storybook allowances viewer form authorized weight #5439
Conversation
…lay-allowances-in-sidebar-component
@@ -173,6 +174,7 @@ | |||
"lines": 40, | |||
"statements": 40 | |||
} | |||
} | |||
}, | |||
"transformIgnorePatterns": ["node_modules/(?!(imask)/)/"] |
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.
Jest tests had trouble doing some transform for the imask library. Followed this thread that describes the solution uNmAnNeR/imaskjs#322
|
…mb-4638-storybook-authorized-weight-form
const initialValues = { authorizedWeight: `${authorizedWeight}` }; | ||
|
||
const validationSchema = Yup.object({ | ||
authorizedWeight: Yup.number().required('Required'), |
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 think we need to add a validation to prevent the user from entering the number zero
@donaldthai My more general question is why if authorizedWeight is null in the database the value coming back in the payload is set to the weightAllotment +- dependents. Won't it make the user think they don't need to confirm the authorized weight because we show it already populated? Maybe that's part of @Ronolibert 's backend story making that change to not load that value by default. |
@duncan-truss Under normal circumstances, the AuthorizedWeight is stored in the DB at the time the order is created during customer onboarding. The value is initially the same as the weight allowance based on rank and dependents. Our test data does not populate the |
Thanks for explaining that @monfresh |
@@ -39,7 +53,17 @@ describe('AllowancesDetailForm', () => { | |||
}); | |||
|
|||
it('uses defaults for undefined values', () => { | |||
const wrapperNoProps = mount(<AllowancesDetailForm entitlements={{}} />); | |||
const wrapperNoProps = mount( | |||
<Formik initialValues={{ authorizedWeight: '0' }} onSubmit={jest.fn()}> |
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.
Do we want to set this to null instead of zero since authorizedWeight could have a null value in theory since it's a pointer.
describe('with masking', () => { | ||
const wrapper = mount( | ||
<TextMaskedInput | ||
// value={"8000"} |
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.
looks like you added this below
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.
Works well for me! The library says it's IE11 compatible too.
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.
Looks good and seems to meet the reasonable acceptance criteria. (note: I think there's some left over acceptance criteria for when it's in the system that can't be covered here)
Description
Reviewer Notes
Is there anything you would like reviewers to give additional scrutiny?
Setup
Add any steps or code to run in this section to help others prepare to run your code:
Storybook
http://localhost:6006/?path=/story/too-tio-components-allowancesdetailform--basic
View allowances page
Edit Allowances
buttonCode Review Verification Steps
References
Screenshots
Storybook
View allowances page
Number mask in action