Question 1 / 1
A test fills in an email input using dispatchEvent(new Event('input')) with value 'test@test.com'. The template shows an error with *ngIf="emailControl.invalid || !emailControl.touched". The test then asserts the error is hidden. The assertion fails — the error is still visible. What is the most likely cause?
typescript it('hides error when valid email is entered', () => { const input = fixture.nativeElement.querySelector('#email'); input.value = 'test@test.com'; input.dispatchEvent(new Event('input')); // sets value and dirty fixture.detectChanges();
const error = fixture.nativeElement.querySelector('.email-error'); expect(error).toBeNull(); // fails });