diff options
author | Timmy Willison <4timmywil@gmail.com> | 2018-01-03 11:01:26 -0500 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2018-01-08 11:45:21 -0500 |
commit | 7be448d41fa124474aeee8423d57df11073791fd (patch) | |
tree | 45a9306bfd559659eb95aa2ad4fca715e4cf9512 | |
parent | 80f57f8a13debaab87b99f73631669699da3e1a5 (diff) | |
download | jquery-7be448d41fa124474aeee8423d57df11073791fd.tar.gz jquery-7be448d41fa124474aeee8423d57df11073791fd.zip |
Ajax: add unit test for getScript(Object)
Fixes gh-3736
Close gh-3918
-rw-r--r-- | test/unit/ajax.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index a8fd3a075..b84ce4872 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -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 |