X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fajax.js;h=2a2ac46a1549205ec133d1d02656a06926795158;hb=2ac4067a639856a6035c3bd00aab132c9714b52d;hp=80da7f8f88734bf59b190ca0862c71f002aa0192;hpb=1ddfdabbb983e2d3bf7f7200a3da5051f274e6fe;p=jquery.git diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 80da7f8..2a2ac46 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -344,7 +344,7 @@ test(".ajax() - retry with jQuery.ajax( this )", function() { test(".ajax() - headers" , function() { - expect( 2 ); + expect( 4 ); stop(); @@ -376,8 +376,14 @@ test(".ajax() - headers" , function() { tmp.push( "ajax-send: test\n" ); tmp = tmp.join( "" ); - equals( data , tmp , "Headers were sent" ); - equals( xhr.getResponseHeader( "Sample-Header" ) , "Hello World" , "Sample header received" ); + strictEqual( data , tmp , "Headers were sent" ); + strictEqual( xhr.getResponseHeader( "Sample-Header" ) , "Hello World" , "Sample header received" ); + if ( jQuery.browser.mozilla ) { + ok( true, "Firefox doesn't support empty headers" ); + } else { + strictEqual( xhr.getResponseHeader( "Empty-Header" ) , "" , "Empty header received" ); + } + strictEqual( xhr.getResponseHeader( "Sample-Header2" ) , "Hello World 2" , "Second sample header received" ); }, error: function(){ ok(false, "error"); } @@ -486,7 +492,7 @@ test(".ajax() - hash", function() { test("jQuery ajax - cross-domain detection", function() { - expect( 4 ); + expect( 5 ); var loc = document.location, otherPort = loc.port === 666 ? 667 : 666, @@ -502,6 +508,14 @@ test("jQuery ajax - cross-domain detection", function() { }); jQuery.ajax({ + url: 'app:/path', + beforeSend: function( _ , s ) { + ok( s.crossDomain , "Adobe AIR app:/ URL detected as cross-domain" ); + return false; + } + }); + + jQuery.ajax({ dataType: "jsonp", url: loc.protocol + '//somewebsitethatdoesnotexist-656329477541.com:' + ( loc.port || 80 ), beforeSend: function( _ , s ) {