-
Notifications
You must be signed in to change notification settings - Fork 1
[MPDX-9540] - Show step progress and current step indicator in PDS Goal Calculator #1769
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
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a53db3a
[MPDX-9540] - Show step progress and current step indicator in PDS Go…
wjames111 1517e85
Runs prettier
wjames111 3af3f75
Fix completion logic
wjames111 51cadfc
Fix test
wjames111 50f99de
PR fixes
wjames111 66201c9
Runs prettier
wjames111 156321e
Simplify tests
wjames111 6e10749
PR fixes
wjames111 7239959
Refactor
wjames111 65607cc
PR fixes
wjames111 911001e
Add test for 403b
wjames111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
...s/HrTools/PdsGoalCalculator/ReimbursableExpenses/ReimbursableExpensesSectionList.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import { render, waitFor, within } from '@testing-library/react'; | ||
| import { PdsGoalCalculatorTestWrapper } from '../PdsGoalCalculatorTestWrapper'; | ||
| import { ReimbursableExpensesSectionList } from './ReimbursableExpensesSectionList'; | ||
|
|
||
| const allReimbursableUntouched = { | ||
| ministryCellPhone: null, | ||
| ministryInternet: null, | ||
| mpdNewsletter: null, | ||
| mpdMiscellaneous: null, | ||
| accountTransfers: null, | ||
| otherMonthlyReimbursements: null, | ||
| conferenceRetreatCosts: null, | ||
| ministryTravelMeals: null, | ||
| otherAnnualReimbursements: null, | ||
| }; | ||
|
|
||
| describe('ReimbursableExpensesSectionList', () => { | ||
| it('renders both sections as incomplete when no reimbursable fields have been touched', async () => { | ||
| const { findAllByRole } = render( | ||
| <PdsGoalCalculatorTestWrapper calculationMock={allReimbursableUntouched}> | ||
| <ReimbursableExpensesSectionList /> | ||
| </PdsGoalCalculatorTestWrapper>, | ||
| ); | ||
|
|
||
| const items = await findAllByRole('listitem'); | ||
| expect(items).toHaveLength(2); | ||
|
|
||
| const [monthly, annual] = items; | ||
| expect(monthly).toHaveTextContent('Monthly Reimbursable Expenses'); | ||
| expect(annual).toHaveTextContent('Annual Reimbursable Expenses'); | ||
|
|
||
| await waitFor(() => { | ||
| expect( | ||
| within(monthly).getByTestId('RadioButtonUncheckedIcon'), | ||
| ).toBeInTheDocument(); | ||
| expect( | ||
| within(annual).getByTestId('RadioButtonUncheckedIcon'), | ||
| ).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| it('marks only Monthly complete when a monthly field is touched', async () => { | ||
| const { findAllByRole } = render( | ||
| <PdsGoalCalculatorTestWrapper | ||
| calculationMock={{ ...allReimbursableUntouched, ministryCellPhone: 25 }} | ||
| > | ||
| <ReimbursableExpensesSectionList /> | ||
| </PdsGoalCalculatorTestWrapper>, | ||
| ); | ||
|
|
||
| const [monthly, annual] = await findAllByRole('listitem'); | ||
| await waitFor(() => { | ||
| expect(within(monthly).getByTestId('CircleIcon')).toBeInTheDocument(); | ||
| expect( | ||
| within(annual).getByTestId('RadioButtonUncheckedIcon'), | ||
| ).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| it('marks only Annual complete when an annual field is touched', async () => { | ||
| const { findAllByRole } = render( | ||
| <PdsGoalCalculatorTestWrapper | ||
| calculationMock={{ | ||
| ...allReimbursableUntouched, | ||
| conferenceRetreatCosts: 100, | ||
| }} | ||
| > | ||
| <ReimbursableExpensesSectionList /> | ||
| </PdsGoalCalculatorTestWrapper>, | ||
| ); | ||
|
|
||
| const [monthly, annual] = await findAllByRole('listitem'); | ||
| await waitFor(() => { | ||
| expect( | ||
| within(monthly).getByTestId('RadioButtonUncheckedIcon'), | ||
| ).toBeInTheDocument(); | ||
| expect(within(annual).getByTestId('CircleIcon')).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
| }); |
28 changes: 28 additions & 0 deletions
28
...onents/HrTools/PdsGoalCalculator/ReimbursableExpenses/ReimbursableExpensesSectionList.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import React from 'react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import { SectionList } from '../../GoalCalculator/SharedComponents/SectionList'; | ||
| import { usePdsGoalCalculator } from '../Shared/PdsGoalCalculatorContext'; | ||
| import { | ||
| isAnnualReimbursableComplete, | ||
| isMonthlyReimbursableComplete, | ||
| } from '../Shared/pdsCompletion'; | ||
|
|
||
| export const ReimbursableExpensesSectionList: React.FC = () => { | ||
| const { t } = useTranslation(); | ||
| const { calculation } = usePdsGoalCalculator(); | ||
|
|
||
| return ( | ||
| <SectionList | ||
| sections={[ | ||
| { | ||
| title: t('Monthly Reimbursable Expenses'), | ||
| complete: isMonthlyReimbursableComplete(calculation), | ||
| }, | ||
| { | ||
| title: t('Annual Reimbursable Expenses'), | ||
| complete: isAnnualReimbursableComplete(calculation), | ||
| }, | ||
| ]} | ||
| /> | ||
| ); | ||
| }; |
35 changes: 35 additions & 0 deletions
35
src/components/HrTools/PdsGoalCalculator/Setup/SetupSectionList.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { render, waitFor, within } from '@testing-library/react'; | ||
| import { PdsGoalCalculatorTestWrapper } from '../PdsGoalCalculatorTestWrapper'; | ||
| import { SetupSectionList } from './SetupSectionList'; | ||
|
|
||
| describe('SetupSectionList', () => { | ||
| it('renders the Setup section as complete when calculation has all required fields', async () => { | ||
| const { findByRole } = render( | ||
| <PdsGoalCalculatorTestWrapper> | ||
| <SetupSectionList /> | ||
| </PdsGoalCalculatorTestWrapper>, | ||
| ); | ||
|
|
||
| const setupItem = await findByRole('listitem'); | ||
| expect(setupItem).toHaveTextContent('Setup'); | ||
| await waitFor(() => | ||
| expect(within(setupItem).getByTestId('CircleIcon')).toBeInTheDocument(), | ||
| ); | ||
| }); | ||
|
|
||
| it('renders the Setup section as incomplete when calculation is missing required fields', async () => { | ||
| const { findByRole } = render( | ||
| <PdsGoalCalculatorTestWrapper calculationMock={{ name: '' }}> | ||
| <SetupSectionList /> | ||
| </PdsGoalCalculatorTestWrapper>, | ||
| ); | ||
|
|
||
| const setupItem = await findByRole('listitem'); | ||
| expect(setupItem).toHaveTextContent('Setup'); | ||
| await waitFor(() => | ||
| expect( | ||
| within(setupItem).getByTestId('RadioButtonUncheckedIcon'), | ||
| ).toBeInTheDocument(), | ||
| ); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.