title: How can I unit test jquery dialog get displayed?
body: <p>I wrote below code, try to test if a jquery dialog get excused and displayed.</p>
  
  <pre><code>var jqueryMock = sinon.mock(jQuery);
  var dialogExpectation = jqueryMock.expects("dialog");
  dialogExpectation.once();
  
  //call my function, in which create a jquery dialog.
  
  equals(dialogExpectation.verify(), true, "Dialog is displayed");
  jqueryMock.restore();   
  </code></pre>
  
  <p>However, it shows me the error:
  Died on test #1: Attempted to wrap undefined property dialog as function - { "message": "Attempted to wrap undefined property dialog as function", "name": "TypeError" }</p>
  
  <p>The jquery code is very simple: </p>
  
  <pre><code>displayMessage: function (message, title, hashId) { 
  
  //some logic to build the message, title and hashId.  
  
   $(messageDiv).dialog({
              height: 240,
              width: 375,
              modal: true,
              title: title,
              resizable: false,
              buttons: [{
                  text: localizedErrorMessages['OkText'],
                  click: function () {
                      $(this).dialog("close");
                  }
              }]             
          }); // end of dialog            
      } // end of displayMessage
  </code></pre>
  
  <p>Anyone know how to mock the jquery dialog and write unit test in this scenario?</p>