-
Notifications
You must be signed in to change notification settings - Fork 1
fix: TT-167 Date picker disable future dates #642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #642 +/- ##
==========================================
+ Coverage 93.09% 94.24% +1.15%
==========================================
Files 85 95 +10
Lines 1564 1790 +226
Branches 107 119 +12
==========================================
+ Hits 1456 1687 +231
+ Misses 67 65 -2
+ Partials 41 38 -3
Continue to review full report at Codecov.
|
src/app/modules/shared/components/details-fields/details-fields.component.html
Show resolved
Hide resolved
@@ -468,6 +468,12 @@ describe('DetailsFieldsComponent', () => { | |||
expect(endDateInput.value).not.toEqual(startDateInput.value); | |||
expect(startDateInput.value).toEqual(expectedStartDate); | |||
}); | |||
|
|||
it('on get actual date should return the actual date in isoString ', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need proof: when we select dates in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the name of the test: onGetActualDate should return the actual date in String
@@ -171,6 +171,10 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { | |||
this.selectedTechnologies = $event; | |||
} | |||
|
|||
getActualDate(): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should change this to getCurrentDate
. And update all references from actual date
to current date
src/app/modules/shared/components/details-fields/details-fields.component.spec.ts
Outdated
Show resolved
Hide resolved
@@ -468,6 +468,31 @@ describe('DetailsFieldsComponent', () => { | |||
expect(endDateInput.value).not.toEqual(startDateInput.value); | |||
expect(startDateInput.value).toEqual(expectedStartDate); | |||
}); | |||
|
|||
it('on get actual date should return the current date', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update the references and the name of the test. Something like:
On get current date should return expected date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actualDateExpected
to expectedDate
const slectInput: HTMLInputElement = fixture.debugElement. | ||
nativeElement.querySelector(`input[id="start_date"],input[max="${component.getCurrentDate()}"]`); | ||
|
||
expect(slectInput.id).toEqual('start_date'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it is neccesary to assert the value of id?
|
||
it('on the input with id #start_date we could get the id and max value', () => { | ||
fixture.detectChanges(); | ||
const expectDate = new Date().toISOString().split('T')[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expectDate
to expectedDate
it('on the input with id #start_date we could get the id and max value', () => { | ||
fixture.detectChanges(); | ||
const expectDate = new Date().toISOString().split('T')[0]; | ||
const slectInput: HTMLInputElement = fixture.debugElement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you want to retrieve the selecInput. You only need to queryselector by the id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the name slectInput
should be startDateInput
or dateInput
@@ -468,6 +468,12 @@ describe('DetailsFieldsComponent', () => { | |||
expect(endDateInput.value).not.toEqual(startDateInput.value); | |||
expect(startDateInput.value).toEqual(expectedStartDate); | |||
}); | |||
|
|||
it('on get actual date should return the actual date in isoString ', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the name of the test: onGetActualDate should return the actual date in String
disable future dates on date in and date out