Ajax: add unit test for getScript(Object)

Fixes gh-3736
Close gh-3918
This commit is contained in:
Timmy Willison 2018-01-03 11:01:26 -05:00
parent 80f57f8a13
commit 7be448d41f
No known key found for this signature in database
GPG Key ID: 5F0C8B73EF56CE6F

View File

@ -2281,6 +2281,24 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
} );
} );
QUnit.test( "jQuery.getScript( Object ) - with callback", 2, function( assert ) {
var done = assert.async();
Globals.register( "testBar" );
jQuery.getScript( {
url: url( "mock.php?action=testbar" ),
success: function() {
assert.strictEqual( window[ "testBar" ], "bar", "Check if script was evaluated" );
done();
}
} );
} );
QUnit.test( "jQuery.getScript( Object ) - no callback", 1, function( assert ) {
Globals.register( "testBar" );
jQuery.getScript( { url: url( "mock.php?action=testbar" ) } ).done( assert.async() );
} );
// //----------- jQuery.fn.load()
// check if load can be called with only url