Skip to content
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

chore: changes to pending change request #3340

Merged
merged 5 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ const PendingChangeRequest = ({ application, isCbc = false }) => {
}}
value={isPending ? comment : null}
onCancel={() => {
if (!isUpdateMode) handleChangePendingRequest(!isPending, comment);
setIsUpdateMode(false);
pendingChangeRequestModal.close();
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,14 @@ const PendingChangeRequestModal: React.FC<Props> = ({
actions={[
{
id: 'pending-request-change-save-btn',
label: 'Save comment',
label: 'Save',
onClick: () => onSave(formData.comment),
disabled: value === formData?.comment,
disabled: value && value === formData?.comment,
},
{
id: 'pending-request-change-cancel-btn',
label: 'Cancel',
onClick: () => {
setFormData({ comment: value });
onCancel();
},
onClick: onCancel,
variant: 'secondary',
},
]}
Expand Down
14 changes: 7 additions & 7 deletions app/tests/components/Analyst/PendingChangeRequest.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('The Pending Change Request component', () => {
target: { value: 'Edited comment.' },
});

const saveButton = screen.getByRole('button', { name: 'Save comment' });
const saveButton = screen.getByRole('button', { name: 'Save' });

await act(async () => {
fireEvent.click(saveButton);
Expand Down Expand Up @@ -208,7 +208,7 @@ describe('The Pending Change Request component', () => {
target: { value: 'Edited comment.' },
});

const saveButton = screen.getByRole('button', { name: 'Save comment' });
const saveButton = screen.getByRole('button', { name: 'Save' });

await act(async () => {
fireEvent.click(saveButton);
Expand Down Expand Up @@ -307,7 +307,7 @@ describe('The Pending Change Request component', () => {

const saveButton = screen.getByTestId('pending-request-change-save-btn');

expect(saveButton).toBeDisabled();
expect(saveButton).toBeEnabled();

const cancelButton = screen.getByTestId(
'pending-request-change-cancel-btn'
Expand Down Expand Up @@ -338,7 +338,7 @@ describe('The Pending Change Request component', () => {
target: { value: 'This is a test comment.' },
});

const saveButton = screen.getByRole('button', { name: 'Save comment' });
const saveButton = screen.getByRole('button', { name: 'Save' });

await act(async () => {
fireEvent.click(saveButton);
Expand All @@ -356,7 +356,7 @@ describe('The Pending Change Request component', () => {
);
});

it('create pending change request comments are mandatory', async () => {
it('create pending change request comments are optional', async () => {
componentTestingHelper.loadQuery(mockEmptyQueryPayload);
componentTestingHelper.renderComponent();

Expand All @@ -372,7 +372,7 @@ describe('The Pending Change Request component', () => {
screen.getByText('Comments on pending changes (optional)')
).toBeVisible();

const cancelButton = screen.getByRole('button', { name: 'Cancel' });
const cancelButton = screen.getByRole('button', { name: 'Save' });

await act(async () => {
fireEvent.click(cancelButton);
Expand All @@ -390,7 +390,7 @@ describe('The Pending Change Request component', () => {
);
});

it('pending change request comment edit close button handle modal close only', async () => {
it('pending change request close button handle modal close only', async () => {
componentTestingHelper.loadQuery();
componentTestingHelper.renderComponent();

Expand Down
Loading