@@ -172,7 +172,7 @@ QUnit.module( "ajax", {
172172 firstTime = false ;
173173 jQuery . ajax ( this ) ;
174174 } else {
175- ok ( true , "Test retrying with jQuery.ajax(this) works" ) ;
175+ assert . ok ( true , "Test retrying with jQuery.ajax(this) works" ) ;
176176 jQuery . ajax ( {
177177 url : url ( "data/errorWithText.php" ) ,
178178 data : {
@@ -1848,20 +1848,28 @@ QUnit.module( "ajax", {
18481848 jQuery ( document ) . off ( "ajaxStart ajaxStop" ) ;
18491849 } ) ;
18501850
1851- QUnit . asyncTest ( "jQuery#load() - always use GET method even if it overrided through ajaxSetup (#11264)" , 1 , function ( assert ) {
1852- jQuery . ajaxSetup ( {
1853- type : "POST"
1854- } ) ;
1851+ QUnit . test (
1852+ " jQuery#load() - always use GET method even if it overrided through ajaxSetup (#11264)" , 1 ,
1853+ function ( assert ) {
1854+ var done = assert . async ( ) ;
18551855
1856- jQuery ( "#qunit-fixture" ) . load ( "data/ajax/method.php" , function ( method ) {
1857- assert . equal ( method , "GET" ) ;
1858- QUnit . start ( ) ;
1859- } ) ;
1860- } ) ;
1856+ jQuery . ajaxSetup ( {
1857+ type : "POST"
1858+ } ) ;
18611859
1862- QUnit . asyncTest ( "#11402 - jQuery.domManip() - script in comments are properly evaluated" , 2 , function ( ) {
1863- jQuery ( "#qunit-fixture" ) . load ( "data/cleanScript.html" , start ) ;
1864- } ) ;
1860+ jQuery ( "#qunit-fixture" ) . load ( "data/ajax/method.php" , function ( method ) {
1861+ assert . equal ( method , "GET" ) ;
1862+ done ( ) ;
1863+ } ) ;
1864+ }
1865+ ) ;
1866+
1867+ QUnit . test (
1868+ "#11402 - jQuery.domManip() - script in comments are properly evaluated" , 2 ,
1869+ function ( assert ) {
1870+ jQuery ( "#qunit-fixture" ) . load ( "data/cleanScript.html" , assert . async ( ) ) ;
1871+ }
1872+ ) ;
18651873
18661874//----------- jQuery.get()
18671875
@@ -1926,37 +1934,43 @@ QUnit.module( "ajax", {
19261934
19271935//----------- jQuery.getScript()
19281936
1929- QUnit . asyncTest ( "jQuery.getScript( String, Function ) - with callback" , 2 , function ( assert ) {
1930- Globals . register ( "testBar" ) ;
1931- jQuery . getScript ( url ( "data/testbar.php" ) , function ( ) {
1932- assert . strictEqual ( window [ "testBar" ] , "bar" , "Check if script was evaluated" ) ;
1933- QUnit . start ( ) ;
1934- } ) ;
1935- } ) ;
1937+ QUnit . test ( "jQuery.getScript( String, Function ) - with callback" , 2 ,
1938+ function ( assert ) {
1939+ var done = assert . async ( ) ;
1940+
1941+ Globals . register ( "testBar" ) ;
1942+ jQuery . getScript ( url ( "data/testbar.php" ) , function ( ) {
1943+ assert . strictEqual ( window [ "testBar" ] , "bar" , "Check if script was evaluated" ) ;
1944+ done ( ) ;
1945+ } ) ;
1946+ }
1947+ ) ;
19361948
1937- QUnit . asyncTest ( "jQuery.getScript( String, Function ) - no callback" , 1 , function ( ) {
1949+ QUnit . test ( "jQuery.getScript( String, Function ) - no callback" , 1 , function ( assert ) {
19381950 Globals . register ( "testBar" ) ;
1939- jQuery . getScript ( url ( "data/testbar.php" ) ) . done ( start ) ;
1951+ jQuery . getScript ( url ( "data/testbar.php" ) ) . done ( assert . async ( ) ) ;
19401952 } ) ;
19411953
1942- QUnit . asyncTest ( "#8082 - jQuery.getScript( String, Function ) - source as responseText" , 2 , function ( assert ) {
1954+ QUnit . test ( "#8082 - jQuery.getScript( String, Function ) - source as responseText" , 2 , function ( assert ) {
1955+ var done = assert . async ( ) ;
1956+
19431957 Globals . register ( "testBar" ) ;
19441958 jQuery . getScript ( url ( "data/testbar.php" ) , function ( data , _ , jqXHR ) {
19451959 assert . strictEqual ( data , jqXHR . responseText , "Same-domain script requests returns the source of the script" ) ;
1946- QUnit . start ( ) ;
1960+ done ( ) ;
19471961 } ) ;
19481962 } ) ;
19491963
19501964// //----------- jQuery.fn.load()
19511965
19521966 // check if load can be called with only url
1953- QUnit . asyncTest ( "jQuery.fn.load( String )" , 2 , function ( assert ) {
1967+ QUnit . test ( "jQuery.fn.load( String )" , 2 , function ( assert ) {
19541968 jQuery . ajaxSetup ( {
19551969 beforeSend : function ( ) {
19561970 assert . strictEqual ( this . type , "GET" , "no data means GET request" ) ;
19571971 }
19581972 } ) ;
1959- jQuery ( "#first" ) . load ( "data/name.html" , start ) ;
1973+ jQuery ( "#first" ) . load ( "data/name.html" , assert . async ( ) ) ;
19601974 } ) ;
19611975
19621976 QUnit . test ( "jQuery.fn.load() - 404 error callbacks" , function ( assert ) {
@@ -1971,23 +1985,23 @@ QUnit.module( "ajax", {
19711985 } ) ;
19721986
19731987 // check if load can be called with url and null data
1974- QUnit . asyncTest ( "jQuery.fn.load( String, null )" , 2 , function ( assert ) {
1988+ QUnit . test ( "jQuery.fn.load( String, null )" , 2 , function ( assert ) {
19751989 jQuery . ajaxSetup ( {
19761990 beforeSend : function ( ) {
19771991 assert . strictEqual ( this . type , "GET" , "no data means GET request" ) ;
19781992 }
19791993 } ) ;
1980- jQuery ( "#first" ) . load ( "data/name.html" , null , start ) ;
1994+ jQuery ( "#first" ) . load ( "data/name.html" , null , assert . async ( ) ) ;
19811995 } ) ;
19821996
19831997 // check if load can be called with url and undefined data
1984- QUnit . asyncTest ( "jQuery.fn.load( String, undefined )" , 2 , function ( assert ) {
1998+ QUnit . test ( "jQuery.fn.load( String, undefined )" , 2 , function ( assert ) {
19851999 jQuery . ajaxSetup ( {
19862000 beforeSend : function ( ) {
19872001 assert . strictEqual ( this . type , "GET" , "no data means GET request" ) ;
19882002 }
19892003 } ) ;
1990- jQuery ( "#first" ) . load ( "data/name.html" , undefined , start ) ;
2004+ jQuery ( "#first" ) . load ( "data/name.html" , undefined , assert . async ( ) ) ;
19912005 } ) ;
19922006
19932007 // check if load can be called with only url
0 commit comments