QUnit.test( "ajax", function( assert ) {
assert.expect( 4 );
- var done = jQuery.map( new Array( 3 ), function() { return assert.async(); } );
+ var done = assert.async( 3 );
jQuery.ajax( {
type: "GET",
url: url( "mock.php?action=name&name=foo" ),
success: function( msg ) {
assert.strictEqual( msg, "bar", "Check for GET" );
- done.pop()();
+ done();
}
} );
data: "name=peter",
success: function( msg ) {
assert.strictEqual( msg, "pan", "Check for POST" );
- done.pop()();
+ done();
}
} );
jQuery( "#first" ).load( url( "name.html" ), function() {
assert.ok( /^ERROR/.test( jQuery( "#first" ).text() ),
"Check if content was injected into the DOM" );
- done.pop()();
+ done();
} );
} );
}
QUnit[ jQuery.when ? "test" : "skip" ]( "jQuery.when(jQuery.ready)", function( assert ) {
assert.expect( 2 );
- var done = jQuery.map( new Array( 2 ), function() { return assert.async(); } );
+ var done = assert.async( 2 );
whenified.then( function() {
assert.ok( jQuery.isReady, "jQuery.when Deferred resolved" );
- done.pop()();
+ done();
} );
jQuery.when( jQuery.ready ).then( function() {
assert.ok( jQuery.isReady, "jQuery.when Deferred resolved" );
- done.pop()();
+ done();
} );
} );
QUnit.test( "Promise.resolve(jQuery.ready)", function( assert ) {
assert.expect( 2 );
- var done = jQuery.map( new Array( 2 ), function() { return assert.async(); } );
+ var done = assert.async( 2 );
promisified.then( function() {
assert.ok( jQuery.isReady, "Native promised resolved" );
- done.pop()();
+ done();
} );
Promise.resolve( jQuery.ready ).then( function() {
assert.ok( jQuery.isReady, "Native promised resolved" );
- done.pop()();
+ done();
} );
} );