@@ -186,7 +186,7 @@ QUnit.module( "ajax", {
186186 firstTime = false ;
187187 jQuery . ajax ( this ) ;
188188 } else {
189- ok ( true , "Test retrying with jQuery.ajax(this) works" ) ;
189+ assert . ok ( true , "Test retrying with jQuery.ajax(this) works" ) ;
190190 jQuery . ajax ( {
191191 url : url ( "data/errorWithText.php" ) ,
192192 data : {
@@ -1686,20 +1686,28 @@ QUnit.module( "ajax", {
16861686 jQuery ( document ) . off ( "ajaxStart ajaxStop" ) ;
16871687 } ) ;
16881688
1689- QUnit . asyncTest ( "jQuery#load() - always use GET method even if it overrided through ajaxSetup (#11264)" , 1 , function ( assert ) {
1690- jQuery . ajaxSetup ( {
1691- type : "POST"
1692- } ) ;
1689+ QUnit . test (
1690+ " jQuery#load() - always use GET method even if it overrided through ajaxSetup (#11264)" , 1 ,
1691+ function ( assert ) {
1692+ var done = assert . async ( ) ;
16931693
1694- jQuery ( "#qunit-fixture" ) . load ( "data/ajax/method.php" , function ( method ) {
1695- assert . equal ( method , "GET" ) ;
1696- QUnit . start ( ) ;
1697- } ) ;
1698- } ) ;
1694+ jQuery . ajaxSetup ( {
1695+ type : "POST"
1696+ } ) ;
16991697
1700- QUnit . asyncTest ( "#11402 - jQuery.domManip() - script in comments are properly evaluated" , 2 , function ( ) {
1701- jQuery ( "#qunit-fixture" ) . load ( "data/cleanScript.html" , start ) ;
1702- } ) ;
1698+ jQuery ( "#qunit-fixture" ) . load ( "data/ajax/method.php" , function ( method ) {
1699+ assert . equal ( method , "GET" ) ;
1700+ done ( ) ;
1701+ } ) ;
1702+ }
1703+ ) ;
1704+
1705+ QUnit . test (
1706+ "#11402 - jQuery.domManip() - script in comments are properly evaluated" , 2 ,
1707+ function ( assert ) {
1708+ jQuery ( "#qunit-fixture" ) . load ( "data/cleanScript.html" , assert . async ( ) ) ;
1709+ }
1710+ ) ;
17031711
17041712//----------- jQuery.get()
17051713
@@ -1764,37 +1772,43 @@ QUnit.module( "ajax", {
17641772
17651773//----------- jQuery.getScript()
17661774
1767- QUnit . asyncTest ( "jQuery.getScript( String, Function ) - with callback" , 2 , function ( assert ) {
1768- Globals . register ( "testBar" ) ;
1769- jQuery . getScript ( url ( "data/testbar.php" ) , function ( ) {
1770- assert . strictEqual ( window [ "testBar" ] , "bar" , "Check if script was evaluated" ) ;
1771- QUnit . start ( ) ;
1772- } ) ;
1773- } ) ;
1775+ QUnit . test ( "jQuery.getScript( String, Function ) - with callback" , 2 ,
1776+ function ( assert ) {
1777+ var done = assert . async ( ) ;
1778+
1779+ Globals . register ( "testBar" ) ;
1780+ jQuery . getScript ( url ( "data/testbar.php" ) , function ( ) {
1781+ assert . strictEqual ( window [ "testBar" ] , "bar" , "Check if script was evaluated" ) ;
1782+ done ( ) ;
1783+ } ) ;
1784+ }
1785+ ) ;
17741786
1775- QUnit . asyncTest ( "jQuery.getScript( String, Function ) - no callback" , 1 , function ( ) {
1787+ QUnit . test ( "jQuery.getScript( String, Function ) - no callback" , 1 , function ( assert ) {
17761788 Globals . register ( "testBar" ) ;
1777- jQuery . getScript ( url ( "data/testbar.php" ) ) . done ( start ) ;
1789+ jQuery . getScript ( url ( "data/testbar.php" ) ) . done ( assert . async ( ) ) ;
17781790 } ) ;
17791791
1780- QUnit . asyncTest ( "#8082 - jQuery.getScript( String, Function ) - source as responseText" , 2 , function ( assert ) {
1792+ QUnit . test ( "#8082 - jQuery.getScript( String, Function ) - source as responseText" , 2 , function ( assert ) {
1793+ var done = assert . async ( ) ;
1794+
17811795 Globals . register ( "testBar" ) ;
17821796 jQuery . getScript ( url ( "data/testbar.php" ) , function ( data , _ , jqXHR ) {
17831797 assert . strictEqual ( data , jqXHR . responseText , "Same-domain script requests returns the source of the script" ) ;
1784- QUnit . start ( ) ;
1798+ done ( ) ;
17851799 } ) ;
17861800 } ) ;
17871801
17881802// //----------- jQuery.fn.load()
17891803
17901804 // check if load can be called with only url
1791- QUnit . asyncTest ( "jQuery.fn.load( String )" , 2 , function ( assert ) {
1805+ QUnit . test ( "jQuery.fn.load( String )" , 2 , function ( assert ) {
17921806 jQuery . ajaxSetup ( {
17931807 beforeSend : function ( ) {
17941808 assert . strictEqual ( this . type , "GET" , "no data means GET request" ) ;
17951809 }
17961810 } ) ;
1797- jQuery ( "#first" ) . load ( "data/name.html" , start ) ;
1811+ jQuery ( "#first" ) . load ( "data/name.html" , assert . async ( ) ) ;
17981812 } ) ;
17991813
18001814 QUnit . test ( "jQuery.fn.load() - 404 error callbacks" , function ( assert ) {
@@ -1809,23 +1823,23 @@ QUnit.module( "ajax", {
18091823 } ) ;
18101824
18111825 // check if load can be called with url and null data
1812- QUnit . asyncTest ( "jQuery.fn.load( String, null )" , 2 , function ( assert ) {
1826+ QUnit . test ( "jQuery.fn.load( String, null )" , 2 , function ( assert ) {
18131827 jQuery . ajaxSetup ( {
18141828 beforeSend : function ( ) {
18151829 assert . strictEqual ( this . type , "GET" , "no data means GET request" ) ;
18161830 }
18171831 } ) ;
1818- jQuery ( "#first" ) . load ( "data/name.html" , null , start ) ;
1832+ jQuery ( "#first" ) . load ( "data/name.html" , null , assert . async ( ) ) ;
18191833 } ) ;
18201834
18211835 // check if load can be called with url and undefined data
1822- QUnit . asyncTest ( "jQuery.fn.load( String, undefined )" , 2 , function ( assert ) {
1836+ QUnit . test ( "jQuery.fn.load( String, undefined )" , 2 , function ( assert ) {
18231837 jQuery . ajaxSetup ( {
18241838 beforeSend : function ( ) {
18251839 assert . strictEqual ( this . type , "GET" , "no data means GET request" ) ;
18261840 }
18271841 } ) ;
1828- jQuery ( "#first" ) . load ( "data/name.html" , undefined , start ) ;
1842+ jQuery ( "#first" ) . load ( "data/name.html" , undefined , assert . async ( ) ) ;
18291843 } ) ;
18301844
18311845 // check if load can be called with only url
0 commit comments