feat: refactor settings page to use reactive forms for landlord profile

This commit is contained in:
nessar committed 2026-08-17 14:18:15 +02:00
1 parent b76dd27431
commit 5d2abf4184
4 files changed
+136 -219

No files matched your search

@@ -47,18 +47,18 @@ describe('SettingsPage', () => {
fixture.detectChanges();
await fixture.whenStable();
expect(fixture.nativeElement.querySelector('input[name=firstName]').value).toBe('Camille');
expect(fixture.nativeElement.querySelector('input[name=email]').value).toBe(
expect(fixture.nativeElement.querySelector('input#firstName').value).toBe('Camille');
expect(fixture.nativeElement.querySelector('input#email').value).toBe(
'camille@example.com',
);
expect(fixture.nativeElement.querySelector('input[name=address]').value).toBe('1 rue de Paris');
expect(fixture.nativeElement.querySelector('input#address').value).toBe('1 rue de Paris');
});
it('shows a useful error instead of saving an incomplete profile', () => {
const fixture = TestBed.createComponent(SettingsPage);
fixture.detectChanges();
const component = fixture.componentInstance;
component.phone.set('');
component.profileModel.update((p) => ({ ...p, phone: '' }));
component.save();
fixture.detectChanges();
@@ -82,7 +82,7 @@ describe('SettingsPage', () => {
const fixture = TestBed.createComponent(SettingsPage);
fixture.detectChanges();
const component = fixture.componentInstance;
component.email.set('alex@example.com');
component.profileModel.update((p) => ({ ...p, email: 'alex@example.com' }));
component.save();
fixture.detectChanges();
@@ -96,6 +96,6 @@ describe('SettingsPage', () => {
address: '1 rue de Paris',
});
expect(fixture.nativeElement.textContent).toContain('Cette adresse e-mail est déjà utilisée.');
expect(fixture.nativeElement.querySelector('input[name=email]').value).toBe('alex@example.com');
expect(fixture.nativeElement.querySelector('input#email').value).toBe('alex@example.com');
});
});