Merge pull request #25008 from overleaf/msm-missing-close-handler-modal

[web] Fix `cancel` button in `UnlinkUserModal`.

GitOrigin-RevId: 5b84c9593ce59c6da9aae9cf4f8e763151202d34
This commit is contained in:
Miguel Serrano
2025-04-30 15:13:19 +02:00
committed by Copybot
parent 828eef0407
commit b8a11fc62f
2 changed files with 14 additions and 1 deletions

View File

@@ -108,7 +108,11 @@ export default function UnlinkUserModal({
</p>
</OLModalBody>
<OLModalFooter>
<OLButton variant="secondary" disabled={unlinkInFlight}>
<OLButton
variant="secondary"
disabled={unlinkInFlight}
onClick={onClose}
>
{t('cancel')}
</OLButton>
<OLButton

View File

@@ -58,6 +58,15 @@ describe('<UnlinkUserModal />', function () {
await waitFor(() => expect(defaultProps.onClose).to.have.been.called)
})
it('closes the modal on cancelling', async function () {
renderWithContext(<UnlinkUserModal {...defaultProps} />)
const cancelButton = screen.getByRole('button', { name: 'Cancel' })
fireEvent.click(cancelButton)
await waitFor(() => expect(defaultProps.onClose).to.have.been.called)
})
it('handles errors', async function () {
fetchMock.post(`/manage/groups/${groupId}/unlink-user/${userId}`, 500)