@testing-library/react version: 11.1.0 const datePicker = getByTestId("date-picker");
fireEvent.click(datePicker);
console.log(datePicker);
fireEvent.change(datePicker, { target: { value: "29 Oct, 2020" } });
expect(datePicker.value).toBe("29 Oct, 2020");
I trying to

https://codesandbox.io/s/datepicker-test-forked-c1jjp?file=/src/index.test.js
The value of the date picker component wasn't changed
This seems to be a bug with antd 3 (see original issue solution). antd 4 has already fixed this using the same React Testing Library code, and if <input type="date" /> is used instead it still works (though you'd have to use a different format).
I don't think we should support a workaround for a bug in another library that's already been patched unless React Testing Library is doing something incorrectly. If you can show proof of React Testing Library doing something incorrectly with a date input that isn't based on antd we may be able to help.
Otherwise, you have some alternative options:
Got it.
Thanks @nickmccurdy
Most helpful comment
This seems to be a bug with antd 3 (see original issue solution). antd 4 has already fixed this using the same React Testing Library code, and if
<input type="date" />is used instead it still works (though you'd have to use a different format).I don't think we should support a workaround for a bug in another library that's already been patched unless React Testing Library is doing something incorrectly. If you can show proof of React Testing Library doing something incorrectly with a date input that isn't based on antd we may be able to help.
Otherwise, you have some alternative options: