MM-52881: Fix date picker selected day (#23391)

This commit is contained in:
LeonardJouve 2023-06-14 18:51:37 +02:00 committed by GitHub
parent 8e13e7fffe
commit c7895c6f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View File

@ -142,4 +142,33 @@ describe('MM-T4066 Setting manual status clear time more than 7 days away', () =
// * Correct clear time should be displayed in the status dropdown
cy.get('.status-dropdown-menu .custom_status__expiry time').should('have.text', dateToBeSelected.format('MMM DD'));
});
it('MM-52881 should show the selected date when reopening the date picker', () => {
// # clear the status
cy.get('.input-clear-x').click();
// # open the status modal
cy.get('.custom_status__row').click();
// # select the first option
cy.get('.statusSuggestion__row').first().click();
// # open the date picker
cy.get('.dateTime__calendar-icon').click();
// * Verify that DayPicker overlay is visible
cy.get('.date-picker__popper').should('be.visible');
// # Click on the date which is dateToBeSelected
for (let i = 0; i < months; i++) {
cy.get('.fa-angle-right').click();
}
cy.get('.date-picker__popper').find(`.rdp-month button[aria-label="${dateToBeSelected.format('Do MMMM (dddd)')}"]`).click();
// # reopen the date picker
cy.get('.dateTime__calendar-icon').click();
// * Verify that date selected is still selected
cy.get('.date-picker__popper').find(`.rdp-month button[aria-label="${dateToBeSelected.format('Do MMMM (dddd)')}"]`).should('have.class', 'rdp-day_selected');
});
});

View File

@ -145,7 +145,8 @@ const DateTimeInputContainer: React.FC<Props> = (props: Props) => {
const datePickerProps: DayPickerProps = {
initialFocus: isPopperOpen,
mode: 'single',
selected: currentTime,
selected: time.toDate(),
defaultMonth: time.toDate(),
onDayClick: handleDayChange,
disabled: [{
before: currentTime,