title: Testing code within addEventHandler
body: <p>I have the following -</p>
  
  <pre><code>window.addEventListener( "orientationchange", () =&gt; {
      // Code to test
  });
  </code></pre>
  
  <p>How can I trigger this event in Jasmine? I have tried the following and it didn't work -</p>
  
  <pre><code>event = document.createEvent("HTMLEvents");
  event.initEvent("orientationchange", true, true);
  </code></pre>
  
  <p>Here is the class - </p>
  
  <pre><code>export class AvailabilityComponent {
  
      changed: boolean = false;
  
      constructor(  ) {
          window.addEventListener( "orientationchange", () =&gt; {
              this.changed = !this.changed;
          } );
      }
  
  }
  </code></pre>
  
  <p>Thanks</p>