describe('AppComponent', function () { var de; var comp; var fixture; beforeEach(testing_1.async(function () { testing_1.TestBed.configureTestingModule({ declarations: [app_component_1.AppComponent] }) .compileComponents(); })); beforeEach(function () { fixture = testing_1.TestBed.createComponent(app_component_1.AppComponent); comp = fixture.componentInstance; de = fixture.debugElement.query(platform_browser_1.By.css('h1')); }); it('should create component', function () { return expect(comp).toBeDefined(); }); it('should have expected <h1> text', function () { fixture.detectChanges(); var h1 = de.nativeElement; expect(h1.innerText).toMatch(/angular/i, '<h1> should say something about "Angular"'); }); });
describe('AppComponent', function () { let de: DebugElement; let comp: AppComponent; let fixture: ComponentFixture<AppComponent>; beforeEach(async(() => { 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.innerText).toMatch(/angular/i, '<h1> should say something about "Angular"'); }); });