Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: TTA-49 fixing code format
  • Loading branch information
jimmyjaramillo committed Jun 15, 2022
commit 92c8865a2412220f78fa85362914d78cf8ffac74
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,3 @@
<button type="submit" class="btn btn-primary">Search</button>
</div>
</form>



Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
display: flex;
justify-content: space-between;
width: 100%;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import * as moment from 'moment';
import { ToastrService } from 'ngx-toastr';
import { EntryState } from 'src/app/modules/time-clock/store/entry.reducer';
import * as entryActions from '../../../time-clock/store/entry.actions';


import { TimeRangeCustomComponent } from './time-range-custom.component';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add one aditional whitespace after imports


describe('TimeRangeCustomComponent', () => {
let component: TimeRangeCustomComponent;
let fixture: ComponentFixture<TimeRangeCustomComponent>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { FormControl, FormGroup } from '@angular/forms';
import { TimeRangeHeaderComponent } from './time-range-header/time-range-header.component';
import { DATE_FORMAT } from 'src/environments/environment';
import { formatDate } from '@angular/common';
import {Store} from '@ngrx/store';
import {EntryState} from '../../../time-clock/store/entry.reducer';
import { Store } from '@ngrx/store';
import { EntryState } from '../../../time-clock/store/entry.reducer';
import { ToastrService } from 'ngx-toastr';

import * as entryActions from '../../../time-clock/store/entry.actions';
import * as moment from 'moment';

Expand Down Expand Up @@ -60,4 +59,3 @@ export class TimeRangeCustomComponent implements OnInit, OnChanges {
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
display: flex;
align-items: center;
padding: 0.5em;
}
}

.time-range-header-label {
flex: 1;
height: 1em;
font-weight: 500;
text-align: center;
}
.time-range-header-label {
flex: 1;
height: 1em;
font-weight: 500;
text-align: center;
}

.time-range-double-arrow .mat-icon {
margin: -22%;
}
.time-range-double-arrow .mat-icon {
margin: -22%;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import { MatNativeDateModule } from '@angular/material/core';
import { MatCalendar, MatDateRangePicker } from '@angular/material/datepicker';
import { By } from '@angular/platform-browser';
import { of } from 'rxjs';

import { TimeRangeHeaderComponent } from './time-range-header.component';


describe('TimeRangeHeaderComponent', () => {
let component: TimeRangeHeaderComponent<any>;
let fixture: ComponentFixture<TimeRangeHeaderComponent<any>>;

const value = {
stateChanges:{
stateChanges: {
pipe: () => {
return of({sucess: 'test'})
return of({sucess: 'test'});
}
},
activeDate: new Date()
}
};

beforeEach(async () => {
await TestBed.configureTestingModule({
Expand Down Expand Up @@ -59,22 +59,22 @@ describe('TimeRangeHeaderComponent', () => {
buttonsAll.forEach((button: any) => {
spyOn(component, button.method);
button.values.forEach((val: any) => {
let buttonElement = fixture.debugElement.query(By.css(val.style));
const buttonElement = fixture.debugElement.query(By.css(val.style));
buttonElement.triggerEventHandler('click', null);
tick();
expect(component[button.method]).toHaveBeenCalledWith(val.call);
})
})
});
});
}));

it('should call method changeDate with nextClicked', () => {
spyOn(component, 'changeDate').withArgs('month', 1)
spyOn(component, 'changeDate').withArgs('month', 1);
component.nextClicked('month');
expect(component.changeDate).toHaveBeenCalledWith('month', 1);
});

it('should call method changeDate with previousClicked', () => {
spyOn(component, 'changeDate').withArgs('year', -1)
spyOn(component, 'changeDate').withArgs('year', -1);
component.previousClicked('year');
expect(component.changeDate).toHaveBeenCalledWith('year', -1);
});
Expand All @@ -94,5 +94,5 @@ describe('TimeRangeHeaderComponent', () => {
component.changeDate('year', -1);
expect(component.calendar.activeDate.toDateString()).toEqual(makeDateYear.toDateString());
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { MatCalendar } from '@angular/material/datepicker';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';


@Component({
// selector: 'app-time-range-header',
templateUrl: './time-range-header.component.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
>
{{ item }}
</button>
</mat-card>
</mat-card>
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ $width: 128px;
left: 0;
display: flex;
width: 100%;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { MatDateRangePicker } from '@angular/material/datepicker';
import { MatDialogModule } from '@angular/material/dialog';
import { By } from '@angular/platform-browser';
import { ToastrService } from 'ngx-toastr';

import { TimeRangePanelComponent } from './time-range-panel.component';


describe('TimeRangePanelComponent', () => {
let component: TimeRangePanelComponent<any>;
let fixture: ComponentFixture<TimeRangePanelComponent<any>>;
const valueFunction = () => {
const valueFunction = () => {
return '';
};
const toastrServiceStub = {
error: () => {
error: () => {
return 'error';
}
};
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('TimeRangePanelComponent', () => {


it('should click selectRange button and call calculateDateRange method', () => {
spyOn(component, 'calculateDateRange').and.returnValues(['','']);
spyOn(component, 'calculateDateRange').and.returnValues(['', '']);
component.selectRange('today');
expect(component.calculateDateRange).toHaveBeenCalled();
});
Expand Down Expand Up @@ -92,27 +92,29 @@ describe('TimeRangePanelComponent', () => {
const dataAll = [
{range: 'this year', values:
{start: {year: currentYear, month: 0, day: 1},
end:{year: currentYear, month: 11, day: 31}
end: {year: currentYear, month: 11, day: 31}
}
},
{range: 'last year',
values:
{start: {year: currentYear-1, month: 0, day: 1},
end: {year: currentYear-1, month: 11, day: 31}
{start: {year: currentYear - 1, month: 0, day: 1},
end: {year: currentYear - 1, month: 11, day: 31}
}
},
];
dataAll.forEach((val: any) => {
const [start, end] = component.calculateDateRange(val.range);
expect(new Date(start).toDateString()).toEqual(new Date(val.values.start.year, val.values.start.month, val.values.start.day).toDateString());
expect(new Date(end).toDateString()).toEqual(new Date(val.values.end.year, val.values.end.month, val.values.end.day).toDateString());
expect(new Date(start).toDateString()).toEqual(
new Date(val.values.start.year, val.values.start.month, val.values.start.day).toDateString());
expect(new Date(end).toDateString()).toEqual(
new Date(val.values.end.year, val.values.end.month, val.values.end.day).toDateString());
});
});

it('should return a time range month when is called calculateMonth method', () => {
const currentYear = new Date().getFullYear();
const currentMonth = new Date().getMonth();
const currentDays= new Date(currentYear, currentMonth + 1, 0).getDate()
const currentDays = new Date(currentYear, currentMonth + 1, 0).getDate();
const [start, end] = component.calculateMonth(new Date());
expect(new Date(start).toDateString()).toEqual(new Date(currentYear, currentMonth, 1).toDateString());
expect(new Date(end).toDateString()).toEqual(new Date(currentYear, currentMonth , currentDays).toDateString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { DateAdapter } from '@angular/material/core';
import { MatDateRangePicker } from '@angular/material/datepicker';
import { ToastrService } from 'ngx-toastr';


const customPresets = [
'today',
'last 7 days',
Expand Down Expand Up @@ -108,4 +109,3 @@ export class TimeRangePanelComponent<D> {
return today;
}
}