Replace browser confirmations with confirmation dialog

This commit is contained in:
nessar committed 2026-08-17 14:18:15 +02:00
1 parent a8a3d7a747
commit 5c19f244fc
17 files changed
+397 -34

No files matched your search

@@ -78,4 +78,44 @@ describe('TenantCard', () => {
expect(download.disabled).toBe(true);
expect(download.textContent).toContain('Téléchargement…');
});
it('shows a separate remove action for attachments', () => {
const fixture = TestBed.createComponent(TenantCard);
fixture.componentRef.setInput('tenant', {
id: 'tenant-1',
firstName: 'Camille',
lastName: 'Martin',
email: 'camille@example.com',
phone: '',
address: '',
attachments: [
{ id: 'attachment-1', fileName: 'id.pdf', contentType: 'application/pdf', size: 42 },
],
});
fixture.componentRef.setInput('deletingAttachmentIds', new Set(['attachment-1']));
fixture.detectChanges();
const remove = fixture.nativeElement.querySelector('.attachment-delete');
expect(remove.disabled).toBe(true);
expect(remove.textContent).toContain('Suppression…');
expect(remove.getAttribute('aria-label')).toBe('Retirer la pièce jointe id.pdf');
});
it('uses a Font Awesome cross icon for the remove action', () => {
const fixture = TestBed.createComponent(TenantCard);
fixture.componentRef.setInput('tenant', {
id: 'tenant-1',
firstName: 'Camille',
lastName: 'Martin',
email: 'camille@example.com',
phone: '',
address: '',
attachments: [
{ id: 'attachment-1', fileName: 'id.pdf', contentType: 'application/pdf', size: 42 },
],
});
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('.attachment-delete fa-icon')).not.toBeNull();
});
});