Skip to content

Commit a4510c5

Browse files
authored
fix: TT-255 add condition canMarkEntryAsWip to view date out and time out (#692)
1 parent a570617 commit a4510c5

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/app/modules/shared/components/details-fields/details-fields.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
</div>
113113
</div>
114114

115-
<div class="form-group row" *ngIf="!goingToWorkOnThis">
115+
<div class="form-group row" *ngIf="!goingToWorkOnThis || !canMarkEntryAsWIP">
116116
<label class="col-12 col-sm-2">Date out:</label>
117117
<div class="col-12 col-sm-4">
118118
<input
@@ -146,7 +146,7 @@
146146
</div>
147147
</div>
148148

149-
<div class="form-group row" *ngIf="!goingToWorkOnThis">
149+
<div class="form-group row" *ngIf="!goingToWorkOnThis || !canMarkEntryAsWIP">
150150
<label class="col-12 col-sm-2">Total Hours:</label>
151151
<div class="col-12 col-sm-4">
152152
<span class="border-tag"

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,23 @@ describe('DetailsFieldsComponent', () => {
633633
component.onSubmit();
634634
expect(displayError).toBeTrue();
635635
});
636+
637+
it('should show Date out field on details field component on time entry page when another entry is running', () => {
638+
const times = {
639+
start_date: '2021-04-21',
640+
end_date: '2021-04-21',
641+
start_hour: '10:00',
642+
end_hour: '12:00',
643+
};
644+
component.goingToWorkOnThis = true;
645+
spyOn(toastrServiceStub, 'error');
646+
647+
const fixtureToTest = TestBed.createComponent(DetailsFieldsComponent);
648+
const componentToTest = fixtureToTest.componentInstance;
649+
componentToTest.entryForm.setValue({ ...formValues, ...times });
650+
componentToTest.onSubmit();
651+
expect(toastrServiceStub.error).not.toHaveBeenCalled();
652+
});
636653
/*
637654
TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component,
638655
and now these couple of tests are failing. A solution to this error might be generate a Test Wrapper Component. More details here:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
292292
timezone_offset: new Date().getTimezoneOffset(),
293293
};
294294

295-
if (this.goingToWorkOnThis) {
295+
if (this.goingToWorkOnThis && this.canMarkEntryAsWIP) {
296296
delete entry.end_date;
297297
}
298298

0 commit comments

Comments
 (0)