mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
The last commit change `async` to `waitForAsync`. This commit update all usages in the code and also update aio doc. PR Close #37583
29 lines
936 B
TypeScript
29 lines
936 B
TypeScript
import { DebugElement } from '@angular/core';
|
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
import { By } from '@angular/platform-browser';
|
|
|
|
import { AppComponent } from './app.component';
|
|
|
|
describe('AppComponent', () => {
|
|
let de: DebugElement;
|
|
let comp: AppComponent;
|
|
let fixture: ComponentFixture<AppComponent>;
|
|
|
|
beforeEach(waitForAsync(() => {
|
|
TestBed.configureTestingModule({declarations: [AppComponent]}).compileComponents();
|
|
}));
|
|
|
|
beforeEach(() => {
|
|
fixture = TestBed.createComponent(AppComponent);
|
|
comp = fixture.componentInstance;
|
|
de = fixture.debugElement.query(By.css('h1'));
|
|
});
|
|
|
|
it('should create component', () => expect(comp).toBeDefined());
|
|
|
|
it('should have expected <h1> text', () => {
|
|
fixture.detectChanges();
|
|
const h1 = de.nativeElement;
|
|
expect(h1.textContent).toMatch(/angular/i, '<h1> should say something about "Angular"');
|
|
});
|
|
});
|