Spectrum is now read-only. Learn more about the decision in our official announcement.

Testing Library

Use instead


Using fireEvent.paste

February 8, 2019 at 12:54am
The Testing Library community has a new home. This thread is preserved for historical purposes. The content of this conversation may be innaccurrate or out of date. Go to new community home →

Using fireEvent.paste

February 8, 2019 at 12:54am
Anyone have any experience using this event? I have a component that accepts pasted text, so I need to be able to confirm that it is taking the appropriate actions when text is pasted, but I can't seem to figure out how to pass text through to the clipboard.
Everytime I fire the event, event.clipboardData in the components onPaste handler is undefined. I imagine I have to somehow copy some text into the clipboard first, but I can't figure out how to make it work.

March 23, 2019 at 8:41am
I have the same issue window.Event does not allow event init clipboardData to be passed in via fireEvent.paste(node, { clipboardData: { getData: () => ({ data: 'contents', type: 'text/plain' }) }});
In dom-testing-library:
const event = new EventConstructor(eventName, eventInit);
which returns
Event {
isTrusted: true

June 4, 2019 at 2:02pm
I'm not sure I get it , do you mean that it is possible to test it with /dom? I haven't been able to find information for that EventConstructor. Any clues?

July 4, 2019 at 3:52pm
Please anybody reply on the above question. I have been also facing the same issue which
facing. [ Link :

Using fireEvent.paste

]Thanks in advance.

July 8, 2019 at 7:47pm
+1 Also having trouble with this

July 19, 2019 at 2:37am
+1 me too.