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