diff options
author | 杨宇千 <crupest@outlook.com> | 2019-02-22 13:37:03 +0000 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-02-22 13:37:03 +0000 |
commit | 4178d790e3afa5c556751d37453d1d62b16e80be (patch) | |
tree | 4980a15f9470b9672922af4bab3de4bb9e92e65b /Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts | |
parent | 5452ada657b7a3a4b2a91563a5ff03dcb798c684 (diff) | |
parent | 4e16aeba21313b527eef904501b7a69a72372791 (diff) | |
download | timeline-4178d790e3afa5c556751d37453d1d62b16e80be.tar.gz timeline-4178d790e3afa5c556751d37453d1d62b16e80be.tar.bz2 timeline-4178d790e3afa5c556751d37453d1d62b16e80be.zip |
Merged PR 4: Some minor efforts.
Related work items: #1
Diffstat (limited to 'Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts b/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts index 7fc4164d..e01e91fb 100644 --- a/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts +++ b/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts @@ -1,5 +1,5 @@ import { Component, NO_ERRORS_SCHEMA } from '@angular/core'; -import { async, ComponentFixture, TestBed, tick } from '@angular/core/testing'; +import { async, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; import { defer, Observable } from 'rxjs'; @@ -8,7 +8,8 @@ import { TodoListService, WorkItem } from './todo-list.service'; import { By } from '@angular/platform-browser'; @Component({ - selector: 'mat-progress-bar', +/* tslint:disable-next-line:component-selector*/ +selector: 'mat-progress-bar', template: '' }) class MatProgressBarStubComponent { @@ -45,21 +46,22 @@ describe('TodoListPageComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(TodoListPageComponent); component = fixture.componentInstance; - fixture.detectChanges(); }); it('should create', () => { + fixture.detectChanges(); expect(component).toBeTruthy(); }); it('should show progress bar during loading', () => { + fixture.detectChanges(); expect(fixture.debugElement.query(By.css('mat-progress-bar'))).toBeTruthy(); }); - it('should hide progress bar after loading', async(() => { - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(fixture.debugElement.query(By.css('mat-progress-bar'))).toBeFalsy(); - }); + it('should hide progress bar after loading', fakeAsync(() => { + fixture.detectChanges(); + tick(); + fixture.detectChanges(); + expect(fixture.debugElement.query(By.css('mat-progress-bar'))).toBeFalsy(); })); }); |