Admin-teksten en merklogo: Weergavenaam, Wachtwoord wijzigen, Eerste account aanmaken, logo per thema

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 14:36:10 +01:00
co-authored by Claude Sonnet 5.5
parent cd81723bf5
commit 55dcab121b
20 changed files with 350 additions and 25 deletions
@@ -0,0 +1,39 @@
import { describe, expect, it, vi } from 'vitest';
import { screen } from '@testing-library/react';
import { renderWithProviders } from '@/test/utils';
import { DeleteUserDialog } from '@/features/users/components/DeleteUserDialog';
import type { UserListItem } from '@/features/users/services/types';
function userItem(overrides: Partial<UserListItem>): UserListItem {
return {
id: '22222222-2222-2222-2222-222222222222',
email: 'info@x.nl',
name: 'Bryan',
role: 'User',
isActive: true,
createdAt: '2026-01-01T00:00:00Z',
invitationPending: false,
inviteLink: null,
...overrides,
} as UserListItem;
}
function renderDialog(user: UserListItem) {
return renderWithProviders(
<DeleteUserDialog user={user} open onOpenChange={vi.fn()} onConfirm={vi.fn()} isPending={false} />,
);
}
describe('DeleteUserDialog', () => {
it('names the person and their e-mail address', async () => {
renderDialog(userItem({}));
expect(await screen.findByTestId('delete-user-dialog')).toHaveTextContent('Bryan (info@x.nl)');
});
it('does not repeat the address when the account has no display name', async () => {
renderDialog(userItem({ name: 'info@x.nl' }));
const text = (await screen.findByTestId('delete-user-dialog')).textContent ?? '';
expect(text).toContain('info@x.nl');
expect(text).not.toContain('info@x.nl (info@x.nl)');
});
});
@@ -28,6 +28,9 @@ export function DeleteUserDialog({
const { t } = useTranslation();
if (!user) return null;
// Accounts without a display name come back with the e-mail address as their name; "a@b (a@b)" is noise.
const hasName = user.name.trim() !== '' && user.name.toLowerCase() !== user.email.toLowerCase();
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-md" data-testid="delete-user-dialog">
@@ -36,7 +39,9 @@ export function DeleteUserDialog({
<DialogDescription>
{user.invitationPending
? t('users.delete.descriptionPending', { email: user.email })
: t('users.delete.description', { name: user.name, email: user.email })}
: hasName
? t('users.delete.description', { name: user.name, email: user.email })
: t('users.delete.descriptionNoName', { email: user.email })}
</DialogDescription>
</DialogHeader>
<DialogFooter className="gap-2">