mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 01:44:13 +00:00
feat(settings): confirmations in the shared dialog, token colours on About, scope picker in the new look
This commit is contained in:
@@ -125,13 +125,27 @@ describe('AdminUsersTab', () => {
|
||||
expect(admin.handleEditUser).toHaveBeenCalledWith(alice);
|
||||
});
|
||||
|
||||
it('FE-ADMUSR-009: delete button forwards the row user to handleDeleteUser', () => {
|
||||
it('FE-ADMUSR-009: delete asks first and forwards the row user to handleDeleteUser on confirm', () => {
|
||||
const admin = renderTab({ users: [me, alice], currentUser: me });
|
||||
|
||||
const deleteButtons = screen.getAllByLabelText('Delete user');
|
||||
fireEvent.click(deleteButtons[1]);
|
||||
|
||||
expect(admin.handleDeleteUser).toHaveBeenCalledWith(alice);
|
||||
expect(admin.handleDeleteUser).not.toHaveBeenCalled();
|
||||
expect(screen.getByText(`Delete user "${alice.username}"? All trips will be permanently deleted.`)).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Delete' }));
|
||||
|
||||
expect(admin.handleDeleteUser).toHaveBeenCalledWith(alice, { confirmed: true });
|
||||
});
|
||||
|
||||
it('FE-ADMUSR-009b: cancelling the delete question deletes nothing', () => {
|
||||
const admin = renderTab({ users: [me, alice], currentUser: me });
|
||||
|
||||
fireEvent.click(screen.getAllByLabelText('Delete user')[1]);
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
|
||||
|
||||
expect(screen.queryByText(`Delete user "${alice.username}"? All trips will be permanently deleted.`)).not.toBeInTheDocument();
|
||||
expect(admin.handleDeleteUser).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('FE-ADMUSR-010: the delete button of the current user is disabled', () => {
|
||||
|
||||
Reference in New Issue
Block a user