Skip to content

Commit

Permalink
fix(datepicker): hideSibligsMonthDays on update datepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
aesteves60 authored and dpellier committed Nov 6, 2023
1 parent ffa43c4 commit c2b0bf1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,19 @@ describe('e2e:osds-datepicker', () => {
expect(datepickerPrevDaysNotDisplayed).toBe(true);
});

it('should not displayed sibling month days after updating datepicker', async() => {
await setup({ attributes: { showSiblingsMonthDays: false, value: new Date('2023-05-15') } });
await el.click();
await page.waitForChanges();
await el.setProperty('daysOfWeekDisabled', [ODS_DATEPICKER_DAY.saturday, ODS_DATEPICKER_DAY.sunday]);
const datepickerNextDays = await page.findAll('osds-datepicker >>> .datepicker-grid .day.next');
const datepickerNextDaysNotDisplayed = datepickerNextDays.every((day) => day.classList.contains('no-displayed'));
expect(datepickerNextDaysNotDisplayed).toBe(true);
const datepickerPrevDays = await page.findAll('osds-datepicker >>> .datepicker-grid .day.prev');
const datepickerPrevDaysNotDisplayed = datepickerPrevDays.every((day) => day.classList.contains('no-displayed'));
expect(datepickerPrevDaysNotDisplayed).toBe(true);
});

it('should not navigate on hidden sibling month days', async() => {
await setup({ attributes: { showSiblingsMonthDays: false, value: new Date('2023-05-15') } });
await el.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export class OsdsDatepicker implements OdsDatepickerAttribute, OdsDatepickerEven
? this.minDate
: undefined,
});
this.hideSiblingsMonthDays();
}

emitBlur(): void {
Expand Down

0 comments on commit c2b0bf1

Please sign in to comment.