How can I write a test to test what happens when iframeresizer onMessage is invoked?
msarauer opened this issue · comments
Mitchel Sarauer commented
Is there a way to simulate onMessage being invoked in react-testing-library? I've tried:
const iframe = screen.getByTitle('iframe') as HTMLIFrameElement
const TEST_MESSAGE = 'test-message'
iframe.contentWindow?.postMessage(TEST_MESSAGE, window.location.origin)
but that doesn't seem to work.
David J. Bradshaw commented
Good question, I think that is more for Stack Overflow