title: How to test code inside $(window).on("load", function() {}); in Jasmine
body: <p>I have a javascript below, which appends a DIV on page load and hides it after 3 sec.</p>
  
  <pre><code>var testObj = {
     initialize: function() {
      var that = this;
      $(window).on("load", function() {  
          (function ($) { //Append Div
              $('body').append("&lt;div&gt;TEST&lt;/div&gt;");
          })(jQuery);
          that.hideAppendedDiv();
      });
     },
     hideAppendedDiv: function() {  //Hide appended Div after 3s
      setTimeout(function(){
          $("div").hide();
      }, 3000);
     }
  };
  
  //call Initialize method
  testObj.initialize();
  </code></pre>
  
  <p>How to write Jasmine test cases for the methods in the code.</p>