aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-02-22 13:58:51 +0800
committercrupest <crupest@outlook.com>2019-02-22 13:58:51 +0800
commit55505bf5487bb43e2423bafd46bd50a8b10b0a6f (patch)
treedef06bce269f02864a625ed19bc6832f5a9a1585 /Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts
parent57f88746769432ed2d529a4f050783d84f9fb2bc (diff)
downloadtimeline-55505bf5487bb43e2423bafd46bd50a8b10b0a6f.tar.gz
timeline-55505bf5487bb43e2423bafd46bd50a8b10b0a6f.tar.bz2
timeline-55505bf5487bb43e2423bafd46bd50a8b10b0a6f.zip
Use fakeAsync instead of async.
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.ts15
1 files changed, 8 insertions, 7 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..7623d7aa 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';
@@ -45,21 +45,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();
}));
});