interactors
interactors copied to clipboard
Allow pass a custom third-party interactor to `setDay` action for Calendar
There is a case with custom day render there days from prev and next months could be visible. In that situation setDay with number of the day throws an error because calendar container contains two same days.
test.step(
renderCalendar((onChange) => ({
renderDay: (day, _selectedDate, dayInCurrentMonth, dayComponent) =>
cloneElement(dayComponent, {
hidden: false,
...(dayInCurrentMonth
? undefined
: { style: { opacity: "0.5" }, onClick: () => onChange?.(day as Date) }),
}),
}))
)
.step(Calendar().setDay(4))
.assertion(Calendar("4 September 2014").exists())