title: Ho to write unit test for the modal open?
body: <p>Hi I am writing unit test case for my angular code in Jasmine. I have modal in my popup. On button click I am opening modal.</p>
  
  <p>Below is my component code.</p>
  
  <pre><code>//declaration
      @ViewChild('editorModal')
      editorModal: ModalDirective;
  //button click
       addScope() {
          this.formResetToggle = false;
          setTimeout(() =&gt; {
              this.formResetToggle = true;
              this.scopeEdit = new Scope();
              this.scopeEdit.scopevalue = '';
              this.editorModal.show();
          });
      }
  </code></pre>
  
  <p>Below is my html code.</p>
  
  <pre><code>  &lt;div class="modal fade" bsModal #editorModal="bs-modal" tabindex="-1" id="myModal" role="dialog" aria-labelledby="myModalLabel"&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Below is my unit test.</p>
  
  <pre><code> it('open popup to add scope', () =&gt; {
          component.addScope();
          expect(component.editorModal.show).toHaveBeenCalled(); //error
   });
  </code></pre>
  
  <p>I am trying to write assert statements to make sure my modal has been opened. can someone help me to make above code work? Any help would be appreciated. Thank you </p>