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-25 00:40:27 +0800
committercrupest <crupest@outlook.com>2019-02-25 00:40:27 +0800
commitad16dbe268984d639c4924fb8bb1e69e68c0fef7 (patch)
tree545c805dbd163da10845dfc352a4b3fe8e5ec01b /Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts
parent5e3896fee6b0d376cb7c3f1927596a8ed00e40e4 (diff)
downloadtimeline-ad16dbe268984d639c4924fb8bb1e69e68c0fef7.tar.gz
timeline-ad16dbe268984d639c4924fb8bb1e69e68c0fef7.tar.bz2
timeline-ad16dbe268984d639c4924fb8bb1e69e68c0fef7.zip
Add entrance animation of todo item.
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.ts43
1 files changed, 26 insertions, 17 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 aed32c9a..a757b2a5 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,23 +1,23 @@
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
-import { defer, Observable } from 'rxjs';
+import { Observable, from } from 'rxjs';
import { TodoListPageComponent } from './todo-list-page.component';
import { TodoListService, WorkItem } from './todo-list.service';
import { By } from '@angular/platform-browser';
+import { delay } from 'rxjs/operators';
+import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@Component({
/* tslint:disable-next-line:component-selector*/
selector: 'mat-progress-bar',
template: ''
})
-class MatProgressBarStubComponent {
+class MatProgressBarStubComponent {}
-}
-
-function asyncData<T>(data: T): Observable<T> {
- return defer(() => Promise.resolve(data));
+function asyncArray<T>(data: T[]): Observable<T> {
+ return from(data).pipe(delay(0));
}
describe('TodoListPageComponent', () => {
@@ -29,22 +29,31 @@ describe('TodoListPageComponent', () => {
beforeEach(async(() => {
const todoListService: jasmine.SpyObj<TodoListService> = jasmine.createSpyObj('TodoListService', ['getWorkItemList']);
- mockWorkItems = [{
- id: 0, title: 'Test title 1', isCompleted: true, detailUrl: 'https://test.org/workitems/0', iconUrl: 'https://test.org/icon/0'
- }, {
- id: 1, title: 'Test title 2', isCompleted: false, detailUrl: 'https://test.org/workitems/1', iconUrl: 'https://test.org/icon/1'
- }];
+ mockWorkItems = [
+ {
+ id: 0,
+ title: 'Test title 1',
+ isCompleted: true,
+ detailUrl: 'https://test.org/workitems/0',
+ iconUrl: 'https://test.org/icon/0'
+ },
+ {
+ id: 1,
+ title: 'Test title 2',
+ isCompleted: false,
+ detailUrl: 'https://test.org/workitems/1',
+ iconUrl: 'https://test.org/icon/1'
+ }
+ ];
- todoListService.getWorkItemList.and.returnValue(asyncData(mockWorkItems));
+ todoListService.getWorkItemList.and.returnValue(asyncArray(mockWorkItems));
TestBed.configureTestingModule({
declarations: [TodoListPageComponent, MatProgressBarStubComponent],
- providers: [
- { provide: TodoListService, useValue: todoListService }
- ],
+ imports: [NoopAnimationsModule],
+ providers: [{ provide: TodoListService, useValue: todoListService }],
schemas: [NO_ERRORS_SCHEMA]
- })
- .compileComponents();
+ }).compileComponents();
}));
beforeEach(() => {