Skip to content

Commit 2d8b1e2

Browse files
author
Guido Quezada
committed
TT-39 fix: imporve coverage
1 parent ef66524 commit 2d8b1e2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/app/modules/shared/components/details-fields/details-fields.component.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,16 @@ describe('DetailsFieldsComponent', () => {
267267
expect(endHourInput).toBeNull();
268268
});
269269

270+
it('when the current entry is not running, then the end_date and end_hour of the form should be set', () => {
271+
const startDate = new Date('2020-12-30T09:45:00');
272+
component.entryToEdit = { ...entryToEdit, start_date: startDate };
273+
spyOn(component.entryForm, 'patchValue');
274+
275+
component.onGoingToWorkOnThisChange({ currentTarget: { checked: false } });
276+
277+
expect(component.entryForm.patchValue).toHaveBeenCalledWith( { end_date: '2020-12-30', end_hour: '09:45', } );
278+
});
279+
270280
it('when creating a new entry, then the new entry should be marked as not run', () => {
271281
component.entryToEdit = null;
272282

src/app/modules/shared/components/month-picker/month-picker.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ export class MonthPickerComponent implements OnInit {
3535

3636
changeYear(changeAction: string) {
3737
this.selectedYearMoment[changeAction](1, 'year');
38+
this.selectedYearText = moment(this.selectedYearMoment).format('YYYY');
3839
this.selectedYear = this.selectedYearMoment.year();
3940

4041
const monthIndex = changeAction === 'add' ? 0 : 11;
4142
this.selectMonth(monthIndex);
42-
this.selectedYearText = moment(this.selectedYearMoment).format('YYYY');
4343
}
4444

4545
selectMonth(monthIndex: number) {

0 commit comments

Comments
 (0)