For example, why doesn't the following code work?
asyncTest('yet another asyncTest', function() {
setTimeout(function() {
console.log(5);
ok(true, 'yet another success');
start();
stop()
$.ajax({
url: './index.html',
success: function() {
console.log(6);
ok(true, 'yet another ajax success');
start();
}
})
}, 100)
})
The assertion in the ajax success callback doesn't produce a result,
but the callback is indeed called.
On Oct 23, 8:52 am, Steven Parkes <[email protected]> wrote:
> Tests don't nest in any particularly meaningful way. When you execute
> test(), you add an entry to the queue of tasks to be processed. So
> your nested test is just adding a new test at the end of the queue,
> independent of the current test.
>
> Do you want something as simple as (untested, so to speak):
>
> test('asyncTest', function() {
> stop();
> expect(2);
> setTimeout(function() {
> ok(true, 'success');
> $.ajax({
> url: './index.html',
> success: function() {
> ok(true, 'ajax success');
> start();
> }
> });
> }, 100);
>
> });
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---