I’m experiencing difficulties trying to invoke document.ready( function() {}) in my unit tests. Suppose I have multiple of them in my javascript file, and one of them called inside a named function i.e.
function myFunction() {
$(document).ready(function() {
//...
});
}
How do I actually invoke them in my unit tests so I can actually test them? I’m using JsTestDriver to unit test my javascripts.
Thanks.
Part of the answer to this question can be found here.
Below is the sample code to answer this question based on the above answer:
The index assumes that there is only 1 document.ready function in the source file. Index 0 refers to something else which I believe is info on the browser.