Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,48 @@
<ul class="nav nav-tabs mt-2" id="myTab" role="tablist">
<li class="nav-item">
<a
class="nav-link active nav-active text-black font-weight-bold"
class="nav-link nav-active text-black font-weight-bold"
[ngClass]="{ active: activeTab === 'customer-information' }"
id="customer-information-tab"
data-toggle="tab"
href="#customer-information"
role="tab"
aria-controls="customer-information"
(click)="showTab('customer-information')"
>Customer information</a
>
</li>
<li class="nav-item">
<a
class="nav-link text-black font-weight-bold"
[ngClass]="{ 'nav-active': areTabsActive, disabled: !areTabsActive }"
[ngClass]="{ 'nav-active': areTabsActive, disabled: !areTabsActive, active: activeTab === 'projects-type' }"
id="projects-type-tab"
data-toggle="tab"
href="#projectsType"
role="tab"
aria-controls="projects-type"
(click)="showTab('projects-type')"
>Project types</a
>
</li>
<li class="nav-item">
<a
class="nav-link text-black font-weight-bold"
[ngClass]="{ 'nav-active': areTabsActive, disabled: !areTabsActive }"
[ngClass]="{ 'nav-active': areTabsActive, disabled: !areTabsActive, active: activeTab === 'projects' }"
id="projects-tab"
data-toggle="tab"
href="#projects"
role="tab"
aria-controls="projects"
(click)="showTab('projects')"
>Projects</a
>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div
class="tab-pane fade show active mt-3"
class="tab-pane fade mt-3"
[ngClass]="{ 'show active': activeTab === 'customer-information' }"
id="customer-information"
role="tabpanel"
aria-labelledby="customer-information-tab"
Expand All @@ -48,17 +53,29 @@
(changeValueAreTabsActives)="activeTabs($event)"
></app-create-customer>
</div>
<div class="tab-pane fade mt-3" id="projects" role="tabpanel" aria-labelledby="projects-tab">
<div class="container mb-1">
<app-create-project></app-create-project>
<app-project-list></app-project-list>
</div>
</div>
<div class="tab-pane fade mt-3" id="projectsType" role="tabpanel" aria-labelledby="projects-type-tab">
<div
class="tab-pane fade mt-3"
[ngClass]="{ 'show active': activeTab === 'projects-type' }"
id="projectsType"
role="tabpanel"
aria-labelledby="projects-type-tab"
>
<div class="container">
<app-create-project-type></app-create-project-type>
<app-project-type-list></app-project-type-list>
</div>
</div>
<div
class="tab-pane fade mt-3"
[ngClass]="{ 'show active': activeTab === 'projects' }"
id="projects"
role="tabpanel"
aria-labelledby="projects-tab"
>
<div class="container mb-1">
<app-create-project></app-create-project>
<app-project-list></app-project-list>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ describe('ManagmentCustomerProjectsComponent', () => {
component.activeTabs(true);
setTimeout(() => {
expect(component.areTabsActive).toBeTrue();
expect(component.activeTab).toEqual('customer-information');
}, 1);
});

it('should show customer-information tab', () => {
component.areTabsActive = true;
component.showTab('customer-information');
expect(component.activeTab).toEqual('customer-information');
});

it('should show projects-type tab', () => {
component.areTabsActive = true;
component.showTab('projects-type');
expect(component.activeTab).toEqual('projects-type');
});

it('should show projects tab', () => {
component.areTabsActive = true;
component.showTab('projects');
expect(component.activeTab).toEqual('projects');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ import { Component } from '@angular/core';
})
export class ManagementCustomerProjectsComponent {
areTabsActive: boolean;

activeTab: string;
constructor() {}

activeTabs($areTabsActive: boolean) {
setTimeout(() => this.areTabsActive = $areTabsActive, 1);
setTimeout(() => {
this.areTabsActive = $areTabsActive;
this.activeTab = 'customer-information';
}, 1);
}

showTab(activeTab: string) {
this.activeTab = activeTab;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('TimeEntriesComponent', () => {

it('should call dataByMonth in ngOnInit()', async(() => {
component.ngOnInit();
expect(component.dataByMonth.length).toEqual(1);
expect(component.dataByMonth.length).toEqual(0);
}));

it('should open Delete Modal', () => {
Expand Down