fix: complete loading review coverage (#18)
This commit is contained in:
1 parent
0f68a91c5d
commit
a8a3d7a747
8 files changed
+107
-52
No files matched your search
@@ -64,4 +64,25 @@ describe('ApartmentForm', () => {
|
||||
'Impossible d’enregistrer cet appartement.',
|
||||
);
|
||||
});
|
||||
|
||||
it('preserves entered values after a save fails', async () => {
|
||||
const fixture = TestBed.createComponent(ApartmentForm);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
const form = fixture.componentInstance;
|
||||
form.name.set('T2 rénové');
|
||||
form.address.set('45 rue des Entrepreneurs');
|
||||
form.purchasePrice.set(265000);
|
||||
fixture.componentRef.setInput('saveError', 'Impossible d’enregistrer cet appartement.');
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(fixture.nativeElement.querySelector('input[name=name]').value).toBe('T2 rénové');
|
||||
expect(fixture.nativeElement.querySelector('input[name=address]').value).toBe(
|
||||
'45 rue des Entrepreneurs',
|
||||
);
|
||||
expect(fixture.nativeElement.textContent).toContain(
|
||||
'Impossible d’enregistrer cet appartement.',
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user