Skip to content

Commit 4fe4adb

Browse files
authored
Merge branch 'master' into Clock-Component
2 parents ec2d162 + ddfad12 commit 4fe4adb

13 files changed

+250
-13
lines changed

src/app/app.module.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { CommonModule } from '@angular/common';
12
import { BrowserModule } from '@angular/platform-browser';
23
import { NgModule } from '@angular/core';
34
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -13,6 +14,10 @@ import { TimeClockComponent } from './components/options-sidebar/time-clock/time
1314
import { ProjectManagementComponent } from './components/options-sidebar/project-management/project-management.component';
1415
import { ProjectListComponent } from './components/shared/project-list/project-list.component';
1516
import { CreateProjectComponent } from './components/shared/create-project/create-project.component';
17+
import { TimeClockComponent } from './components/options-sidebar/time-clock/time-clock.component';
18+
import { DetailsFieldsComponent } from './components/shared/details-fields/details-fields.component';
19+
import { ProjectListHoverComponent } from './components/shared/project-list-hover/project-list-hover.component';
20+
1621

1722
@NgModule({
1823
declarations: [
@@ -24,9 +29,13 @@ import { CreateProjectComponent } from './components/shared/create-project/creat
2429
TimeClockComponent,
2530
ProjectManagementComponent,
2631
ProjectListComponent,
27-
CreateProjectComponent
32+
CreateProjectComponent,
33+
TimeClockComponent,
34+
DetailsFieldsComponent,
35+
ProjectListHoverComponent,
2836
],
2937
imports: [
38+
CommonModule,
3039
BrowserModule,
3140
AppRoutingModule,
3241
FormsModule,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.content-ClockIn {
2+
padding: 2.1rem 1rem;
3+
}
4+
5+
.timer {
6+
align-items: center;
7+
display: flex;
8+
height: 100%;
9+
justify-content: center;
10+
}

src/app/components/options-sidebar/time-clock/time-clock.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ <h6 class="text-left"><strong>Projects</strong></h6>
9292
</div>
9393
</div>
9494
</div>
95-
</div>
95+
</div>

src/app/components/options-sidebar/time-clock/time-clock.component.spec.ts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
1+
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
2+
import { By } from "@angular/platform-browser";
3+
import { DebugElement } from "@angular/core";
24

3-
import { TimeClockComponent } from './time-clock.component';
5+
import { TimeClockComponent } from "./time-clock.component";
6+
import { ProjectListHoverComponent } from "../../shared/project-list-hover/project-list-hover.component";
47

5-
describe('TimeClockComponent', () => {
8+
describe("TimeClockComponent", () => {
69
let component: TimeClockComponent;
710
let fixture: ComponentFixture<TimeClockComponent>;
11+
let de: DebugElement;
812

913
function setup() {
1014
// tslint:disable-next-line: no-shadowed-variable
@@ -15,18 +19,18 @@ describe('TimeClockComponent', () => {
1519

1620
beforeEach(async(() => {
1721
TestBed.configureTestingModule({
18-
declarations: [ TimeClockComponent ]
19-
})
20-
.compileComponents();
22+
declarations: [TimeClockComponent, ProjectListHoverComponent]
23+
}).compileComponents();
2124
}));
2225

2326
beforeEach(() => {
2427
fixture = TestBed.createComponent(TimeClockComponent);
2528
component = fixture.componentInstance;
29+
de = fixture.debugElement;
2630
fixture.detectChanges();
2731
});
2832

29-
it('should be created', () => {
33+
it("should be created", () => {
3034
expect(component).toBeTruthy();
3135
});
3236

@@ -39,4 +43,25 @@ describe('TimeClockComponent', () => {
3943
expect(ptag.textContent).toBe('Dario clocked out at hh:mm:ss');
4044
}));
4145

46+
it("should set showfileds as true", () => {
47+
const show = true;
48+
component.setShowFields(show);
49+
expect(component.showFields).toBe(true);
50+
});
51+
52+
it('should be called the setShowFields event #1', () => {
53+
spyOn(component, 'setShowFields');
54+
const showFields = de.query(By.directive(ProjectListHoverComponent));
55+
const cmp = showFields.componentInstance;
56+
cmp.showFields.emit(true);
57+
expect(component.setShowFields).toHaveBeenCalledWith(true);
58+
});
59+
60+
it('should be called the setShowFields event #2', () => {
61+
spyOn(component, 'setShowFields');
62+
const showFields = de.query(By.directive(ProjectListHoverComponent));
63+
const li = showFields.query(By.css('li'));
64+
li.nativeElement.click();
65+
expect(component.setShowFields).toHaveBeenCalledWith(true);
66+
});
4267
});

src/app/components/options-sidebar/time-clock/time-clock.component.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import { Component, OnInit, OnDestroy } from '@angular/core';
22

33
@Component({
4-
selector: 'app-time-clock',
5-
templateUrl: './time-clock.component.html',
6-
styleUrls: ['./time-clock.component.css']
4+
selector: "app-time-clock",
5+
templateUrl: "./time-clock.component.html",
6+
styleUrls: ["./time-clock.component.css"]
77
})
88
export class TimeClockComponent implements OnInit {
9+
projects = [
10+
{ id: "P1", name: "Project 1" },
11+
{ id: "P2", name: "Project 2" },
12+
{ id: "P3", name: "Project 3" },
13+
{ id: "P4", name: "Project 4" }
14+
];
915

1016
username = 'Dario';
1117
clockInUsername = 'hh:mm:ss';
@@ -16,6 +22,7 @@ export class TimeClockComponent implements OnInit {
1622
hour: number;
1723
minute: number;
1824
seconds: number;
25+
showFields: boolean;
1926

2027
constructor() {
2128
this.isClockIn = true;
@@ -48,8 +55,12 @@ export class TimeClockComponent implements OnInit {
4855
this.isEnterTechnology = false;
4956
}
5057
}
58+
59+
setShowFields(show: boolean) {
60+
this.showFields = show;
61+
}
5162

5263
ngOnInit(): void {
5364
}
54-
65+
5566
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.span-width {
2+
width: 6rem;
3+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<form>
2+
<div class="input-group input-group-sm mb-3">
3+
<div class="input-group-prepend">
4+
<label class="input-group-text span-width" for="inputGroupSelect01">Activity</label>
5+
</div>
6+
<select class="custom-select" id="inputGroupSelect01">
7+
<option selected>Choose...</option>
8+
<option value="1">One</option>
9+
<option value="2">Two</option>
10+
<option value="3">Three</option>
11+
</select>
12+
</div>
13+
<div class="input-group input-group-sm mb-3">
14+
<div class="input-group-prepend">
15+
<span class="input-group-text span-width" id="inputGroup-sizing-sm"
16+
>Jira Ticket</span
17+
>
18+
</div>
19+
<input
20+
type="text"
21+
class="form-control"
22+
aria-label="Small"
23+
aria-describedby="inputGroup-sizing-sm"
24+
/>
25+
</div>
26+
<div class="input-group input-group-sm mb-3">
27+
<div class="input-group-prepend">
28+
<span class="input-group-text span-width" id="inputGroup-sizing-sm">Technology</span>
29+
</div>
30+
<input
31+
type="text"
32+
class="form-control"
33+
aria-label="Small"
34+
aria-describedby="inputGroup-sizing-sm"
35+
/>
36+
</div>
37+
<div class="form-group">
38+
<label for="NotesTextarea">Notes</label>
39+
<textarea class="form-control" id="NotesTextarea" rows="3"></textarea>
40+
</div>
41+
</form>
42+
<button class="btn btn-danger btn-sm">
43+
Clock Out
44+
</button>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { DetailsFieldsComponent } from './details-fields.component';
4+
5+
describe('DetailsFieldsComponent', () => {
6+
let component: DetailsFieldsComponent;
7+
let fixture: ComponentFixture<DetailsFieldsComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ DetailsFieldsComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(DetailsFieldsComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-details-fields',
5+
templateUrl: './details-fields.component.html',
6+
styleUrls: ['./details-fields.component.css']
7+
})
8+
export class DetailsFieldsComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit(): void {
13+
}
14+
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.content-projects {
2+
max-height: 10rem;
3+
overflow-x: auto;
4+
}
5+
6+
.content-projects > li {
7+
cursor: pointer;
8+
font-size: 0.8rem;
9+
padding: 0.5rem 0.8rem;
10+
}
11+
12+
.button-clockIn {
13+
font-size: 0.7rem;
14+
padding: 0 0.3rem;
15+
}

0 commit comments

Comments
 (0)