Skip to content
Merged
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
Next Next commit
fix: TT-167 Date picker disable future dates
  • Loading branch information
wobravo committed Mar 5, 2021
commit 4c6b65533fb785ca638a8a12b23a9f23f39db1dd
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,25 @@ describe('DetailsFieldsComponent', () => {

expect(component.getCurrentDate()).toEqual(actualDateExpected);
});

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];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expectDate to expectedDate

const slectInput: HTMLInputElement = fixture.debugElement.
Copy link
Contributor

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.

Copy link
Contributor

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

nativeElement.querySelector(`input[id="start_date"],input[max="${component.getCurrentDate()}"]`);

expect(slectInput.id).toEqual('start_date');
Copy link
Contributor

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?

expect(slectInput.max).toEqual(expectDate);
});

it('on the input with id #end_date we could get the current Date ', () => {
fixture.detectChanges();
const expectDate = new Date().toISOString().split('T')[0];
const slectInput = fixture.debugElement.nativeElement.querySelector('[id=end_date]');

expect(slectInput.id).toEqual('end_date');
expect(slectInput.max).toEqual(expectDate);
});
/*
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