-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding cancel and remind actions to the budget assignment table
- Loading branch information
1 parent
8b12828
commit 6cf5b62
Showing
2 changed files
with
193 additions
and
42 deletions.
There are no files selected for viewing
170 changes: 128 additions & 42 deletions
170
src/components/learner-credit-management/BudgetAssignmentsTable.jsx
This file contains 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 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 |
---|---|---|
|
@@ -343,4 +343,69 @@ describe('<BudgetDetailPage />', () => { | |
|
||
expect(screen.getByText('loading budget details')).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays bulk actions with remind when row selected and state allocated', () => { | ||
useSubsidyAccessPolicy.mockReturnValue({ | ||
isInitialLoading: false, | ||
data: { | ||
uuid: 'a52e6548-649f-4576-b73f-c5c2bee25e9c', | ||
policyType: 'AssignedLearnerCreditAccessPolicy', | ||
isAssignable: true, | ||
}, | ||
}); | ||
const mockLearnerEmail = '[email protected]'; | ||
const mockCourseKey = 'edX+DemoX'; | ||
useBudgetContentAssignments.mockReturnValue({ | ||
isLoading: false, | ||
contentAssignments: { | ||
count: 1, | ||
results: [ | ||
{ | ||
uuid: 'test-uuid', | ||
learnerEmail: mockLearnerEmail, | ||
contentKey: mockCourseKey, | ||
state: 'allocated', | ||
}, | ||
], | ||
numPages: 1, | ||
currentPage: 1, | ||
}, | ||
}); | ||
renderWithRouter(<BudgetDetailPageWrapper />); | ||
const cancelRowAction = screen.getByTestId('cancel-assignment-test-uuid'); | ||
const remindRowAction = screen.getByTestId('remind-assignment-test-uuid'); | ||
expect(cancelRowAction).toBeInTheDocument(); | ||
expect(remindRowAction).toBeInTheDocument(); | ||
}); | ||
|
||
it('hides remind row action when state not allocated', () => { | ||
useSubsidyAccessPolicy.mockReturnValue({ | ||
isInitialLoading: false, | ||
data: { | ||
uuid: 'a52e6548-649f-4576-b73f-c5c2bee25e9c', | ||
policyType: 'AssignedLearnerCreditAccessPolicy', | ||
isAssignable: true, | ||
}, | ||
}); | ||
const mockLearnerEmail = '[email protected]'; | ||
const mockCourseKey = 'edX+DemoX'; | ||
useBudgetContentAssignments.mockReturnValue({ | ||
isLoading: false, | ||
contentAssignments: { | ||
count: 1, | ||
results: [ | ||
{ | ||
uuid: 'test-uuid', | ||
learnerEmail: mockLearnerEmail, | ||
contentKey: mockCourseKey, | ||
state: 'something else', | ||
}, | ||
], | ||
numPages: 1, | ||
currentPage: 1, | ||
}, | ||
}); | ||
renderWithRouter(<BudgetDetailPageWrapper />); | ||
expect(screen.queryByTestId('remind-assignment-test-uuid')).not.toBeInTheDocument(); | ||
}); | ||
}); |