1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @emails react-core
    
  8.  */
    
  9. 
    
  10. 'use strict';
    
  11. 
    
  12. describe('ReactDOMIframe', () => {
    
  13.   let React;
    
  14.   let ReactTestUtils;
    
  15. 
    
  16.   beforeEach(() => {
    
  17.     React = require('react');
    
  18.     ReactTestUtils = require('react-dom/test-utils');
    
  19.   });
    
  20. 
    
  21.   it('should trigger load events', () => {
    
  22.     const onLoadSpy = jest.fn();
    
  23.     let iframe = React.createElement('iframe', {onLoad: onLoadSpy});
    
  24.     iframe = ReactTestUtils.renderIntoDocument(iframe);
    
  25. 
    
  26.     const loadEvent = document.createEvent('Event');
    
  27.     loadEvent.initEvent('load', false, false);
    
  28. 
    
  29.     iframe.dispatchEvent(loadEvent);
    
  30. 
    
  31.     expect(onLoadSpy).toHaveBeenCalled();
    
  32.   });
    
  33. });