-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manage tasks by statuses #130
Conversation
…lations in template for task
3fa1d81
to
482b5a1
Compare
482b5a1
to
63a7778
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall great work, loved the description and the test coverage 👍
@@ -27,4 +27,12 @@ export class AppComponent implements OnInit { | |||
deleted(): void { | |||
this.tasks$ = this.taskService.getAll(); | |||
} | |||
|
|||
statusChanged(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know its already broken without your changes (#brokenWindow) but i would go for an "update" function which is just called in any case because every function is doing the same right now.
|
||
// then | ||
const subscription = result.subscribe(value => { | ||
expect(value).toEqual({id, name, status: TaskStatus.Done}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case it could be that the expect is not even called but the test would not fail. Better use done function for tests like that
const tasks = this.readTasks(); | ||
const restTasks = tasks.filter((task: Task) => !ids.includes(task.id)); | ||
this.writeTasks(restTasks); | ||
return of(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess an empty observable would be the better fit here or at least use "void 0" instead of undefined.
<mat-form-field> | ||
<input type="text" formControlName="name" matInput placeholder="Add a new tiny task…" data-cy="task-input"> | ||
<mat-icon matSuffix aria-label="Add task"(click)="onSubmit()">send</mat-icon> | ||
<mat-icon matSuffix aria-label="Add task" aria-role="button" (click)="onSubmit()">send</mat-icon> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice :D
{ id: '2', name: 'My task 2', status: TaskStatus.Done }, | ||
{ id: '3', name: 'My task 3', status: TaskStatus.Cancelled }, | ||
])); | ||
taskService.deleteAll.and.returnValue(of(null)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this leads to a compile error of the test, should be void 0
|
||
it('should emit event after finished tasks were cleared', () => { | ||
taskService.getAll.and.returnValue(of([])); | ||
taskService.deleteAll.and.returnValue(of(null)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
@@ -29,4 +31,17 @@ export class TaskFormComponent { | |||
this.taskForm.reset(); | |||
}); | |||
} | |||
|
|||
onClearFinishedTasks(): void { | |||
this.taskService.getAll().pipe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should rather go into the service as it is businesslogic that could be reused by other components
]; | ||
const result = pipe.transform(tasks).map(({status}: Task) => status); | ||
expect(result).toEqual(DEFAULT_TASK_STATUS_ORDER); | ||
expect(result[0]).toBe(TaskStatus.Todo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess this is not necessary when you are testing equality one line above
{ id: '5', name: '5', status: TaskStatus.Cancelled }, | ||
]; | ||
const result = pipe.transform(tasks).map(({status}: Task) => status); | ||
expect(result).toEqual(DEFAULT_TASK_STATUS_ORDER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better check would be for the actual tasks ordered correctly. Strictly speaking it would be unnoticed if the pipe would change the id "1" task status to "todo"
Implemented frontend for #29 with local environment
Tasks can be marked as Done and also support other statuses (In Progress, Blocked, Cancelled)
Tasks are sorted with Todo on top (and overall order is: Todo, In Progress, Blocked, Done, Cancelled)
User is able to clear all finished tasks (Done and Cancelled) with button on top
All introduced functionality is covered with tests
Also animation of element addition and removal was added