aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/todo-item/todo-item.component.spec.ts
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-03-04 19:45:49 +0800
committercrupest <crupest@outlook.com>2019-03-04 19:45:49 +0800
commit0ae0459be4f9eade994acbca65a60070672854fb (patch)
treefd003b7971e34f07d12a32274c9d4a1113b0862a /Timeline/ClientApp/src/app/todo-item/todo-item.component.spec.ts
parentcd28058f07fda57f6569316723f776f1b9b80e50 (diff)
downloadtimeline-0ae0459be4f9eade994acbca65a60070672854fb.tar.gz
timeline-0ae0459be4f9eade994acbca65a60070672854fb.tar.bz2
timeline-0ae0459be4f9eade994acbca65a60070672854fb.zip
Migrate todo page from Azure DevOps WorkItems to Github Issues.
Diffstat (limited to 'Timeline/ClientApp/src/app/todo-item/todo-item.component.spec.ts')
-rw-r--r--Timeline/ClientApp/src/app/todo-item/todo-item.component.spec.ts27
1 files changed, 10 insertions, 17 deletions
diff --git a/Timeline/ClientApp/src/app/todo-item/todo-item.component.spec.ts b/Timeline/ClientApp/src/app/todo-item/todo-item.component.spec.ts
index 277eca23..520b6136 100644
--- a/Timeline/ClientApp/src/app/todo-item/todo-item.component.spec.ts
+++ b/Timeline/ClientApp/src/app/todo-item/todo-item.component.spec.ts
@@ -1,7 +1,7 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TodoItemComponent } from './todo-item.component';
-import { WorkItem } from '../todo-list-page/todo-list.service';
+import { TodoItem } from '../todo-list-page/todo-list.service';
import { By } from '@angular/platform-browser';
import { NO_ERRORS_SCHEMA } from '@angular/core';
@@ -9,7 +9,12 @@ describe('TodoItemComponent', () => {
let component: TodoItemComponent;
let fixture: ComponentFixture<TodoItemComponent>;
- let mockWorkItem: WorkItem;
+ const mockTodoItem: TodoItem = {
+ number: 1,
+ title: 'Title',
+ isClosed: true,
+ detailUrl: '/detail',
+ };
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -19,17 +24,9 @@ describe('TodoItemComponent', () => {
}));
beforeEach(() => {
- mockWorkItem = {
- id: 0,
- title: 'Title',
- isCompleted: true,
- detailUrl: '/detail',
- iconUrl: '/icon'
- };
-
fixture = TestBed.createComponent(TodoItemComponent);
component = fixture.componentInstance;
- component.item = mockWorkItem;
+ component.item = mockTodoItem;
fixture.detectChanges();
});
@@ -37,17 +34,13 @@ describe('TodoItemComponent', () => {
expect(component).toBeTruthy();
});
- it('should set icon', () => {
- expect(fixture.debugElement.query(By.css('img.item-icon')).properties['src']).toBe(mockWorkItem.iconUrl);
- });
-
it('should set title', () => {
expect((fixture.debugElement.query(By.css('span.item-title')).nativeElement as HTMLSpanElement).textContent).toBe(
- mockWorkItem.id + '. ' + mockWorkItem.title
+ mockTodoItem.number + '. ' + mockTodoItem.title
);
});
it('should set detail link', () => {
- expect(fixture.debugElement.query(By.css('a.item-detail-button')).properties['href']).toBe(mockWorkItem.detailUrl);
+ expect(fixture.debugElement.query(By.css('a.item-detail-button')).properties['href']).toBe(mockTodoItem.detailUrl);
});
});