feat: add comprehensive loading feedback (#18)

This commit is contained in:
nessar committed 2026-08-17 14:18:15 +02:00
1 parent 45de0cebcc
commit ec3319494b
47 files changed
+1753 -406

No files matched your search

@@ -21,4 +21,44 @@ describe('TenantCard', () => {
expect(fixture.componentInstance.uploadError()).toContain('250 Mo');
});
it('shows measurable progress and disables only its upload control', () => {
const fixture = TestBed.createComponent(TenantCard);
fixture.componentRef.setInput('tenant', {
id: 'tenant-1',
firstName: 'Camille',
lastName: 'Martin',
email: 'camille@example.com',
phone: '',
address: '',
});
fixture.componentRef.setInput('uploading', true);
fixture.componentRef.setInput('uploadProgress', 50);
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('input[type=file]').disabled).toBe(true);
expect(fixture.nativeElement.querySelector('mat-progress-bar')).not.toBeNull();
expect(fixture.nativeElement.textContent).toContain('Envoi : 50 %');
});
it('shows progress only on the selected attachment download', () => {
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('downloadingAttachmentIds', new Set(['attachment-1']));
fixture.detectChanges();
const download = fixture.nativeElement.querySelector('.attachment-row');
expect(download.disabled).toBe(true);
expect(download.textContent).toContain('Téléchargement…');
});
});