@@ -2782,7 +2782,7 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
2782
2782
} ) ;
2783
2783
} ) ;
2784
2784
2785
- QUnit . test ( "jQuery.get( String, null-ish , String ) - dataType with null callback (gh-4989)" ,
2785
+ QUnit . test ( "jQuery.get( String, null, String ) - dataType with null callback (gh-4989)" ,
2786
2786
function ( assert ) {
2787
2787
assert . expect ( 2 ) ;
2788
2788
var done = assert . async ( 2 ) ;
@@ -2802,6 +2802,37 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
2802
2802
} ) ;
2803
2803
} ) ;
2804
2804
2805
+ QUnit . test ( "jQuery.get( String, null-ish, null-ish, String ) - dataType with null/undefined data & callback" ,
2806
+ function ( assert ) {
2807
+ assert . expect ( 8 ) ;
2808
+ var done = assert . async ( 8 ) ;
2809
+
2810
+ [
2811
+ { data : null , success : null } ,
2812
+ { data : null , success : undefined } ,
2813
+ { data : undefined , success : null } ,
2814
+ { data : undefined , success : undefined }
2815
+ ] . forEach ( function ( options ) {
2816
+ var data = options . data ,
2817
+ success = options . success ;
2818
+ jQuery . get ( url ( "mock.php?action=json&header" ) , data , success , "json" )
2819
+ . then ( function ( json ) {
2820
+ assert . deepEqual ( json , { data : { lang : "en" , length : 25 } } ,
2821
+ "`dataType: \"json\"` applied with `" + data + "` data & `" +
2822
+ success + "` success callback" ) ;
2823
+ done ( ) ;
2824
+ } ) ;
2825
+
2826
+ jQuery . get ( url ( "mock.php?action=json&header" ) , null , "text" )
2827
+ . then ( function ( text ) {
2828
+ assert . strictEqual ( text , "{\"data\":{\"lang\":\"en\",\"length\":25}}" ,
2829
+ "`dataType: \"text\"` applied with `" + data + "` data & `" +
2830
+ success + "` success callback" ) ;
2831
+ done ( ) ;
2832
+ } ) ;
2833
+ } ) ;
2834
+ } ) ;
2835
+
2805
2836
//----------- jQuery.getJSON()
2806
2837
2807
2838
QUnit . test ( "jQuery.getJSON( String, Hash, Function ) - JSON array" , function ( assert ) {
0 commit comments