Conversation
* WIP for edit
Edit fixture generator
| @@ -1,13 +1,15 @@ | |||
| 'use client' | |||
|
|
|||
| import ErrorSummary from "@/app/components/ErrorSummary" | |||
There was a problem hiding this comment.
this is reordering of imports to be more standard (react->get data->render pages)
| export default function FormPayment(params: FormPaymentProps) { | ||
| const { t } = useTranslation() | ||
|
|
||
| let formatDate = () => { |
There was a problem hiding this comment.
there is a world where the date methods i wrote for the tests could be generalized as utils. however, it's important to have some separation of the code under test and the code used to test. i've left these separate for that reason, but this could be a change down the line. the deciding question there will be "by combining date utils, am i still testing what i think i'm testing?" truss, maintainer of React USWDS disagrees with me
| control={control} | ||
| rules={{ required: {value:true, message: t('add_income_required_field')} }} | ||
| render={({ field }) => ( | ||
| render={({ |
There was a problem hiding this comment.
this is a buncha churn on getting the datepicker and form validation working. i left them in as a demonstration at how it could work. they don't affect functionality (or, what didn't work before still doesn't work now lolsob)
|
|
||
| interface ExpenseFormPaymentProps { | ||
| onSubmit: SubmitHandler<ExpenseFormPaymentData> | ||
| interface FormExpenseProps { |
There was a problem hiding this comment.
naming consistency change
|
|
||
| it('should load all existing items ot the page', () => { | ||
| expect(screen.getByTestId('amount')).toHaveProperty('value', expense1.item.amount.toString()) | ||
| // expect(screen.getByTestId('date-picker-external-input')).toHaveProperty('value', expense1.item.date) |
There was a problem hiding this comment.
all items that use the form validation <Control> element are commented out here since they don't work as expected and the tests fail. i left them commented out because once this work is underway, you can uncomment these, TDD-style and get moving from my base assumptions on how they should wrok
|
|
||
| it('should load all existing items to the page', () => { | ||
| expect(screen.getByTestId('amount')).toHaveProperty('value', payment1.item.amount.toString()) | ||
| // expect(screen.getByTestId('date-picker-external-input')).toHaveProperty('value', payment1.item.date) |
There was a problem hiding this comment.
same as the expense data + the broken <Control> element/datepicker
|
|
||
| import { addJob } from '@/lib/features/job/jobSlice' | ||
|
|
||
| /** |
There was a problem hiding this comment.
moved to the test date generator
|
|
||
| it('shows navigation buttons', () => { | ||
| render (<Provider store={store}><Page /></Provider>) | ||
| expect(screen.getByTestId('add_another_button')).toBeDefined() |
There was a problem hiding this comment.
with the design change from the last PR, this button is superfluous
| const router = useRouter() | ||
|
|
||
| const routeToStandardDeductionElection = useAppSelector(state => recommendStandardDeduction(state)) | ||
| const { t } = useTranslation() |
There was a problem hiding this comment.
i had to rework how the job list page + its stubs IncomeFormList and IncomeFormListItem were iterating to support mulitple jobs + mulitple payments
| describe('Medicaid and Snap', () => { | ||
| let benefits: BenefitsState | ||
| beforeEach(() => { | ||
| benefits = generateBenefits({ |
There was a problem hiding this comment.
missed doing this in my "make all teh fixtures use generators" PR
app/[locale]/job/review/page.tsx
Outdated
| router.push("/statement/sign") | ||
| } | ||
|
|
||
| const jobItemList = () => { |
There was a problem hiding this comment.
test broke here when i changed iterations on the job list page
| "list_income_delete_button": "Delete", | ||
| "list_income_done_button": "Done", | ||
| "list_income_header": "Would you like to add another person, client, or company who paid you in the last {{day_count}} days?", | ||
| "list_income_list_header": "Your jobs and payments", |
There was a problem hiding this comment.
no longer needed
| */ | ||
| export const selectTotalPaymentsByJob = (state: RootState, jobId: string) => | ||
| selectPaymentsByJob(state, jobId).reduce((total: number, payment: PaymentItem) => total + payment.amount, 0) | ||
| export const selectTotalPaymentsByJob = (state: RootState, jobId: string) => { |
There was a problem hiding this comment.
i had to make this return both the data (as an object byId) and the iterator (allIds)
Ticket Number
FFS-1487
FFS-1688 (i think the payments edit ticket in sprint 8.3)
Description of changes
This work is to enable edit and delete for both payment and expense. Payment is net new, so there was a few more things to add there. Expenses had delete before, but not edit. Also I needed to move expenses to support the
job/[jobId]/expense/[expenseId]/editrouting structure to call up the right item.List of changes
/job/list) and (/job/[jobId]/expenses/list) -- which I know isn't congruent, routing-wise, but I held on this till design is closer to doneRequests for reviewer
Follow on work
TODO KateScreenshots and demonstration
The best way to handle this is to run it locally.