I got a test for this textarea in my component:
<textarea [(ngModel)]="result"></textarea>
And a working test using async:
it('Using async', async(() => {
const result = fixture.debugElement.query(By.css('textarea'));
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(result.nativeElement.value).toBe('Value');
});
}));
This works fine. But I'm trying to do the same with fakeAsync it doesn't work:
it('Using fakeAsync', fakeAsync(() => {
const result = fixture.debugElement.query(By.css('textarea'));
fixture.detectChanges();
tick();
expect(component.result).toBe('Patata'); //--> This works fine
expect(result.nativeElement.value).toBe('Patata'); //-->this doesn't
}));
Can you help me? Thank you!
Aucun commentaire:
Enregistrer un commentaire