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
TT-39 fix: imporve coverage
  • Loading branch information
Guido Quezada committed Dec 30, 2020
commit d54d6de1e990510e82909fe2125381eb1efc0c11
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,16 @@ describe('DetailsFieldsComponent', () => {
expect(endHourInput).toBeNull();
});

it('when the current entry is not running, then the end_date and end_hour of the form should be set', () => {
const startDate = new Date('2020-12-30T09:45:00');
component.entryToEdit = { ...entryToEdit, start_date: startDate };
spyOn(component.entryForm, 'patchValue');

component.onGoingToWorkOnThisChange({ currentTarget: { checked: false } });

expect(component.entryForm.patchValue).toHaveBeenCalledWith( { end_date: '2020-12-30', end_hour: '09:45', } );
});

it('when creating a new entry, then the new entry should be marked as not run', () => {
component.entryToEdit = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export class MonthPickerComponent implements OnInit {

changeYear(changeAction: string) {
this.selectedYearMoment[changeAction](1, 'year');
this.selectedYearText = moment(this.selectedYearMoment).format('YYYY');
this.selectedYear = this.selectedYearMoment.year();

const monthIndex = changeAction === 'add' ? 0 : 11;
this.selectMonth(monthIndex);
this.selectedYearText = moment(this.selectedYearMoment).format('YYYY');
}

selectMonth(monthIndex: number) {
Expand Down