diff options
author | 杨宇千 <crupest@outlook.com> | 2019-02-22 15:24:26 +0000 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-02-22 15:24:26 +0000 |
commit | 5189c65192874c0ee7a69449941056294ecd8517 (patch) | |
tree | a09c99b3a73642c9a44b385b64090b19ac452ca4 /Timeline/ClientApp/src/app/todo-list-page/todo-list-page.component.spec.ts | |
parent | 4178d790e3afa5c556751d37453d1d62b16e80be (diff) | |
parent | 1db7c93ed333b5016fcc7e5947228db9e9e34b51 (diff) | |
download | timeline-5189c65192874c0ee7a69449941056294ecd8517.tar.gz timeline-5189c65192874c0ee7a69449941056294ecd8517.tar.bz2 timeline-5189c65192874c0ee7a69449941056294ecd8517.zip |
Merged PR 5: Develop link feature on todo page.
Develop link feature on todo page.
Related work items: #1, #3
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 | 26 |
1 files changed, 20 insertions, 6 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 e01e91fb..2da74002 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 @@ -8,8 +8,8 @@ import { TodoListService, WorkItem } from './todo-list.service'; import { By } from '@angular/platform-browser'; @Component({ -/* tslint:disable-next-line:component-selector*/ -selector: 'mat-progress-bar', + /* tslint:disable-next-line:component-selector*/ + selector: 'mat-progress-bar', template: '' }) class MatProgressBarStubComponent { @@ -24,14 +24,18 @@ describe('TodoListPageComponent', () => { let component: TodoListPageComponent; let fixture: ComponentFixture<TodoListPageComponent>; + let mockWorkItems: WorkItem[]; + beforeEach(async(() => { const todoListService: jasmine.SpyObj<TodoListService> = jasmine.createSpyObj('TodoListService', ['getWorkItemList']); - todoListService.getWorkItemList.and.returnValue(asyncData(<WorkItem[]>[{ - id: 0, title: 'Test title 1', closed: true + mockWorkItems = [{ + id: 0, title: 'Test title 1', closed: true, detailUrl: 'https://test.org/workitems/0' }, { - id: 1, title: 'Test title 2', closed: false - }])); + id: 1, title: 'Test title 2', closed: false, detailUrl: 'https://test.org/workitems/1' + }]; + + todoListService.getWorkItemList.and.returnValue(asyncData(mockWorkItems)); TestBed.configureTestingModule({ declarations: [TodoListPageComponent, MatProgressBarStubComponent], @@ -64,4 +68,14 @@ describe('TodoListPageComponent', () => { fixture.detectChanges(); expect(fixture.debugElement.query(By.css('mat-progress-bar'))).toBeFalsy(); })); + + it('should set href on item title', fakeAsync(() => { + fixture.detectChanges(); + tick(); + fixture.detectChanges(); + + fixture.debugElement.queryAll(By.css('a.item-title')).forEach((element, index) => { + expect(element.properties['href']).toBe(mockWorkItems[index].detailUrl); + }); + })); }); |