|
1 | | -import { TestBed } from '@angular/core/testing'; |
| 1 | +import { ComponentFixture, TestBed } from '@angular/core/testing'; |
2 | 2 | import { RouterTestingModule } from '@angular/router/testing'; |
3 | 3 | import { AppComponent } from './app.component'; |
4 | 4 |
|
5 | 5 | describe('AppComponent', () => { |
| 6 | + let app: AppComponent; |
| 7 | + let fixture: ComponentFixture<AppComponent>; |
| 8 | + |
6 | 9 | beforeEach(async () => { |
7 | 10 | await TestBed.configureTestingModule({ |
8 | 11 | imports: [RouterTestingModule], |
9 | 12 | declarations: [AppComponent], |
10 | 13 | }).compileComponents(); |
11 | 14 | }); |
12 | 15 |
|
| 16 | + beforeEach(() => { |
| 17 | + fixture = TestBed.createComponent(AppComponent); |
| 18 | + app = fixture.componentInstance; |
| 19 | + fixture.detectChanges(); |
| 20 | + }); |
| 21 | + |
13 | 22 | it('should create the app', () => { |
14 | | - const fixture = TestBed.createComponent(AppComponent); |
15 | | - const app = fixture.componentInstance; |
16 | 23 | expect(app).toBeTruthy(); |
17 | 24 | }); |
18 | 25 |
|
19 | 26 | it(`should have as title 'DSOMM'`, () => { |
20 | | - const fixture = TestBed.createComponent(AppComponent); |
21 | | - const app = fixture.componentInstance; |
22 | 27 | expect(app.title).toEqual('DSOMM'); |
23 | 28 | }); |
| 29 | + |
| 30 | + it('check for fork me on github ribbon generation', () => { |
| 31 | + const fixture = TestBed.createComponent(AppComponent); |
| 32 | + const HTMLElement: HTMLElement = fixture.nativeElement; |
| 33 | + var divTag = HTMLElement.querySelector('div')!; |
| 34 | + var aTag = divTag.querySelector('a')!; |
| 35 | + //console.log(aTag); |
| 36 | + expect(aTag.textContent).toEqual('Fork me on GitHub'); |
| 37 | + }); |
24 | 38 | }); |
0 commit comments