Hi, i'm having a javascript function using jquery:
my.namespace.loadSomeStuff = function() {
$.get('/Services/loadStuff', function(c){
$("#stuffDiv").html(c);
});
};
and am trying to write unit tests for this.
now, since this function is not really returning anything and loading some stuff asynchronous using jquery's 'get' i'm having a hard time testing this.
essentially what i would like to do is call this function, wait until it returns something and then access the loaded elements to verify... something like:
my.namespace.loadSomeStuff(function(){
alert('boo');
assertSame('Login', $("#stuffDiv").find(......);
});
now, i created a in the template that calls the unit test, and it will load and display correctly, but the alert or the assert are never executed.
is there a way i can do this without adding a ton of extra code to every single function i have?
thanks t