diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 4f53b0ba93..64e45e9bfb 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -9,6 +9,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from "@angular/core"; +import { By } from '@angular/platform-browser'; import { TranslateModule } from "ng2-translate"; import { NgbCollapseModule } from '@ng-bootstrap/ng-bootstrap'; import { Store } from "@ngrx/store"; @@ -28,7 +29,7 @@ let el: HTMLElement; describe('App component', () => { - beforeEach(() => { + beforeEach(async(() => { return TestBed.configureTestingModule({ imports: [ CommonModule, TranslateModule.forRoot(), NgbCollapseModule.forRoot()], declarations: [ AppComponent, HeaderComponent ], // declare the test component @@ -40,10 +41,18 @@ describe('App component', () => { } ], schemas: [ CUSTOM_ELEMENTS_SCHEMA ] - }).compileComponents().then(() => { - fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - }); + }) + })); + + // synchronous beforeEach + beforeEach(() => { + fixture = TestBed.createComponent(AppComponent); + + comp = fixture.componentInstance; // BannerComponent test instance + + // query for the title

by CSS element selector + de = fixture.debugElement.query(By.css('p')); + el = de.nativeElement; }); it('should create component', inject([AppComponent], (app: AppComponent) => { diff --git a/src/test-issue.spec.ts b/src/test-issue.spec.ts new file mode 100644 index 0000000000..434b928e29 --- /dev/null +++ b/src/test-issue.spec.ts @@ -0,0 +1,97 @@ +import { + async, + ComponentFixture, + inject, + TestBed +} from '@angular/core/testing'; + +describe('test issue', () => { + it('should test 1', () => { + expect(true).toBe(true); + }); + + it('should test 2', () => { + expect(true).toBe(true); + }); + + it('should test 3', () => { + expect(true).toBe(true); + }); + + it('should test 4', () => { + expect(true).toBe(true); + }); + + it('should test 5', () => { + expect(true).toBe(true); + }); + + it('should test 6', () => { + expect(true).toBe(true); + }); + + it('should test 7', () => { + expect(true).toBe(true); + }); + + it('should test 8', () => { + expect(true).toBe(true); + }); + + it('should test 9', () => { + expect(true).toBe(true); + }); + + it('should test 10', () => { + expect(true).toBe(true); + }); + + it('should test 11', () => { + expect(true).toBe(true); + }); + + it('should test 12', () => { + expect(true).toBe(true); + }); + + it('should test 13', () => { + expect(true).toBe(true); + }); + + it('should test 14', () => { + expect(true).toBe(true); + }); + + it('should test 15', () => { + expect(true).toBe(true); + }); + + it('should test 16', () => { + expect(true).toBe(true); + }); + + it('should test 17', () => { + expect(true).toBe(true); + }); + + it('should test 18', () => { + expect(true).toBe(true); + }); + + it('should test 19', () => { + expect(true).toBe(true); + }); + + it('should test 20', () => { + expect(true).toBe(true); + }); + + it('should test 21', () => { + expect(true).toBe(true); + }); + + it('should test 22', () => { + expect(true).toBe(true); + }); + +});