Skip to content

Commit b0d5f14

Browse files
test(Browse&Request): added an unit test to verify decline reason text area input in decline modal
1 parent 2ac9998 commit b0d5f14

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/components/learner-credit-management/tests/BudgetDetailRequestsTabContent.test.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,19 @@ describe('BudgetDetailRequestsTabContent', () => {
345345
expect(screen.getByTestId('decline-subsidy-request-modal-close-btn')).toBeInTheDocument();
346346
});
347347
});
348+
it('should allow the user to enter a decline reason in the modal', async () => {
349+
const user = userEvent.setup();
350+
render(<BudgetDetailRequestsTabContentWrapper />);
351+
await waitFor(() => {
352+
expect(screen.getByRole('table')).toBeInTheDocument();
353+
});
354+
const declineButton = screen.getByRole('button', { name: /decline/i });
355+
await user.click(declineButton);
356+
const reasonInput = await screen.findByTestId('decline-subsidy-request-reason-input');
357+
await user.type(reasonInput, 'This course is not approved.');
358+
expect(reasonInput).toHaveValue('This course is not approved.');
359+
expect(screen.getByText(/28\/250/i)).toBeInTheDocument();
360+
});
348361

349362
it('should call decline API with default options and refresh requests on successful decline', async () => {
350363
const user = userEvent.setup();

0 commit comments

Comments
 (0)