Question 1 / 1
A component test sets component.errorMessage = 'Not found' and then asserts that a .error-banner element appears in the DOM. The assertion fails even though the template has <div *ngIf="errorMessage" class="error-banner">. What is missing?
typescript it('shows error banner when errorMessage is set', () => { fixture.detectChanges(); // initial render
component.errorMessage = 'Not found'; // Missing step here
const banner = fixture.nativeElement.querySelector('.error-banner'); expect(banner).toBeTruthy(); // fails });