Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unable to test with DateRangePicker #2238

@xereda

Description

@xereda

react-dates version
21.8.0

Describe the bug
I use the "DateRangePicker" component in a project and I need to test the user flow with the Testing Library. The problem is that when I do the first click (userEvent.click()), on the first date, the modal is closed, not waiting for the selection of the second date.

 "@testing-library/react": "^14.0.0",
 "@testing-library/user-event": "^14.4.3",
 "react-dates": "^21.8.0",

Source code (including props configuration)
Steps to reproduce the behavior:

    <DateRangePicker
      noBorder
      minimumNights={0}
      startDate={startDate}
      startDateId="start-date-id"
      endDate={endDate}
      endDateId="end-date-id"
      onDatesChange={handleDatesChange}
      focusedInput={focusedInput}
      onFocusChange={(focusedInput) => setFocusedInput(focusedInput)}
      isOutsideRange={isOutsideRange}
      onClose={handleOnClose}
      withPortal={true}
      customInputIcon={label}
      hideKeyboardShortcutsPanel={true}
    />

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions