From 7be448d41fa124474aeee8423d57df11073791fd Mon Sep 17 00:00:00 2001 From: Timmy Willison <4timmywil@gmail.com> Date: Wed, 3 Jan 2018 11:01:26 -0500 Subject: [PATCH] Ajax: add unit test for getScript(Object) Fixes gh-3736 Close gh-3918 --- test/unit/ajax.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- 2.39.5