The source code adds a load event handler to an element using JQuery. I am testing this using JSTestDriver.
The code looks something like this:-
$(this).load(function () {
alert("Foo");
});
When I run the tests the alert("Foo") never happens. If I change it to:-
$(this).ready(function () {
alert("Foo with Ready");
});
The test works.
If however, the source code is executed separately within an HTML, then it runs fine and I can get the alert("Foo") even when the event is "load".
Is this a bug in JSTestDriver or am I doing something incorrectly? Do, I have to wait till all the event handlers get triggered in the unit tests. (Something on the lines of Thread.join()) ?
-Ajay