-
Notifications
You must be signed in to change notification settings - Fork 1
#3-Time clock find project #61
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,31 @@ | ||
| <div class="card-body"> | ||
| <div class="scroll"> | ||
| <div class="accordion" id="accordionActivities"> | ||
| <div *ngIf="activities?.length > 0; else notShow"> | ||
| <div class="card" *ngFor="let activity of activities; let rowIndex = index"> | ||
| <div class="card-header"> | ||
| <h2 class="mb-0"> | ||
| <a type="button" data-toggle="collapse" [attr.data-target]="'#row'+rowIndex"> | ||
| {{activity.name}} | ||
| </a> | ||
| <div class="btn-group float-right" role="group"> | ||
| <i class="far fa-edit btn btn-link"></i> | ||
| <i class="far fa-trash-alt btn btn-link"></i> | ||
| </div> | ||
| </h2> | ||
| </div> | ||
| <div class="scroll"> | ||
| <div class="accordion" id="accordionActivities"> | ||
| <div *ngIf="activities?.length > 0; else notShow"> | ||
| <div class="card" *ngFor="let activity of activities; let rowIndex = index"> | ||
| <div class="card-header"> | ||
| <h2 class="mb-0"> | ||
| <a type="button" data-toggle="collapse" [attr.data-target]="'#row'+rowIndex"> | ||
| {{activity.name}} | ||
| </a> | ||
| <div class="btn-group float-right" role="group"> | ||
| <i class="far fa-edit btn btn-link"></i> | ||
| <i class="far fa-trash-alt btn btn-link"></i> | ||
| </div> | ||
| </h2> | ||
| </div> | ||
|
|
||
| <div [id]="'row'+rowIndex" class="collapse" data-parent="#accordionActivities"> | ||
| <div class="card-body"> | ||
| <h5>Description:</h5> | ||
| <p>{{activity.description}}</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div [id]="'row'+rowIndex" class="collapse" data-parent="#accordionActivities"> | ||
| <div class="card-body"> | ||
| <h5>Description:</h5> | ||
| <p>{{activity.description}}</p> | ||
| </div> | ||
| <ng-template #notShow> | ||
| <app-empty-state></app-empty-state> | ||
| </ng-template> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <ng-template #notShow> | ||
| <app-empty-state></app-empty-state> | ||
| </ng-template> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| <div class="row"> | ||
| <div class="col mt-1 time-clock-color"> | ||
| <i *ngIf="!displayTime" class="fas fa-sync-alt fa fa-spin"></i> | ||
| </div> | ||
| <div *ngIf="displayTime" class="col time-clock-color"> | ||
| <h3>{{ hour | number: '2.0-2' }}:{{ minutes | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}</h3> | ||
| </div> | ||
| <div class="col mt-1 time-clock-color"> | ||
| <i *ngIf="!displayTime" class="fas fa-sync-alt fa fa-spin"></i> | ||
| </div> | ||
| <div *ngIf="displayTime" class="col time-clock-color"> | ||
| <h3>{{ hour | number: '2.0-2' }}:{{ minutes | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}</h3> | ||
| </div> | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <div class="form-group"> | ||
| <input (keyup)="changeFilterValue()" type="text" class="form-control" placeholder=" Search projects..." name="filterProject" [(ngModel)]="filterProject" style="font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, FontAwesome"> | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
|
||
| import { SearchProjectComponent } from './search-project.component'; | ||
|
|
||
| describe('SearchProjectComponent', () => { | ||
| let component: SearchProjectComponent; | ||
| let fixture: ComponentFixture<SearchProjectComponent>; | ||
|
|
||
| beforeEach(async(() => { | ||
| TestBed.configureTestingModule({ | ||
| declarations: [SearchProjectComponent] | ||
| }) | ||
| .compileComponents(); | ||
| })); | ||
|
|
||
| beforeEach(() => { | ||
| fixture = TestBed.createComponent(SearchProjectComponent); | ||
| component = fixture.componentInstance; | ||
| fixture.detectChanges(); | ||
| }); | ||
|
|
||
| it('should create', () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('called method', () => { | ||
| component.changeFilterProject.emit('angular'); | ||
| component.filterProject = 'angular'; | ||
| component.changeFilterValue(); | ||
| expect(component.filterProject).toEqual('angular'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that is not a good test because you are assigning the value in the variable and after you wait that your expect has that value. |
||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { Component, OnInit, Output, EventEmitter } from '@angular/core'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-search-project', | ||
| templateUrl: './search-project.component.html', | ||
| styleUrls: ['./search-project.component.scss'] | ||
| }) | ||
| export class SearchProjectComponent implements OnInit { | ||
|
|
||
| filterProject: string; | ||
| @Output() changeFilterProject = new EventEmitter(); | ||
|
|
||
| constructor() { } | ||
|
|
||
| ngOnInit(): void { | ||
| } | ||
|
|
||
| changeFilterValue() { | ||
| this.changeFilterProject.emit(this.filterProject); | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { FilterProjectPipe } from './filter-project.pipe'; | ||
|
|
||
| describe('FilterProjectPipe', () => { | ||
| it('create an instance', () => { | ||
| const pipe = new FilterProjectPipe(); | ||
| expect(pipe).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('test method of pipe', () => { | ||
| expect(new FilterProjectPipe().transform([], '')).toEqual([]); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. improve the test, you can create a mock with projects data and test the transform method. |
||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { Pipe, PipeTransform } from '@angular/core'; | ||
| import { Project } from 'src/app/modules/shared/models/project.model'; | ||
|
|
||
| @Pipe({ | ||
| name: 'filterProject' | ||
| }) | ||
| export class FilterProjectPipe implements PipeTransform { | ||
|
|
||
| transform(value: Project[] = [], arg: string): string[] { | ||
| const restultProjects = []; | ||
| // tslint:disable-next-line: prefer-for-of | ||
| for (let i = 0; i < value.length; i++) { | ||
| if (value[i].name.toLowerCase().indexOf(arg.toLowerCase()) > -1) { | ||
| restultProjects.push(value[i]); | ||
| } | ||
| } | ||
| return restultProjects; | ||
| } | ||
|
|
||
| } |
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 is wrong.