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
fix: TT-255 add condition canMarkEntryAsWip to view date out and time…
… out
  • Loading branch information
kevinjlope committed May 31, 2021
commit 15f958db9b3d44a35f16d41d02ea84e1f0913a17
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
</div>
</div>

<div class="form-group row" *ngIf="!goingToWorkOnThis">
<div class="form-group row" *ngIf="!goingToWorkOnThis || !canMarkEntryAsWIP">
<label class="col-12 col-sm-2">Date out:</label>
<div class="col-12 col-sm-4">
<input
Expand Down Expand Up @@ -146,7 +146,7 @@
</div>
</div>

<div class="form-group row" *ngIf="!goingToWorkOnThis">
<div class="form-group row" *ngIf="!goingToWorkOnThis || !canMarkEntryAsWIP">
<label class="col-12 col-sm-2">Total Hours:</label>
<div class="col-12 col-sm-4">
<span class="border-tag"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,23 @@ describe('DetailsFieldsComponent', () => {
component.onSubmit();
expect(displayError).toBeTrue();
});

it('should show Date out field on details field component on time entry page when another entry is running', () => {
const times = {
start_date: '2021-04-21',
end_date: '2021-04-21',
start_hour: '10:00',
end_hour: '12:00',
};
component.goingToWorkOnThis = true;
spyOn(toastrServiceStub, 'error');

const fixtureToTest = TestBed.createComponent(DetailsFieldsComponent);
const componentToTest = fixtureToTest.componentInstance;
componentToTest.entryForm.setValue({ ...formValues, ...times });
componentToTest.onSubmit();
expect(toastrServiceStub.error).not.toHaveBeenCalled();
});
/*
TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component,
and now these couple of tests are failing. A solution to this error might be generate a Test Wrapper Component. More details here:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
timezone_offset: new Date().getTimezoneOffset(),
};

if (this.goingToWorkOnThis) {
if (this.goingToWorkOnThis && this.canMarkEntryAsWIP) {
delete entry.end_date;
}

Expand Down