-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClipboardEvent is not defined #310
Comments
To build on @afontcu's answer you could use test('Pasting also fires onPaste event which returns clipboard data', () => {
const pasted = jest.fn(() => null);
const changed = jest.fn(() => null);
render(
<PasteComponent paste={pasted} changeEvent={changed} data-testid='paste-input' />);
const PhoneNumberElement = screen.queryByTestId('paste-input');
const paste = createEvent.paste(PhoneNumberElement, {
clipboardData: {
getData: () => '123456',
},
});
fireEvent(PhoneNumberElement, paste);
expect(pasted).toHaveBeenCalled();
expect(pasted).toHaveBeenCalledWith('123456');
}); This might help - https://medium.davidendersby.me/2-ways-to-trigger-the-onpaste-event-with-testing-library-1502c5fdb9e |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when i use ClipboardEvent, it not defined.
but i can use other events, like: MouseEvent, KeybordEvent
The text was updated successfully, but these errors were encountered: