Disabled the Ajax tests from running locally.
[jquery.git] / test / unit / ajax.js
index 872ec08..162650f 100644 (file)
@@ -5,6 +5,8 @@ module("ajax");
 // tests and they'll pass
 //if ( !jQuery.browser.safari ) {
 
+if ( !isLocal ) {
+
 test("$.ajax() - success callbacks", function() {
        expect( 8 );
        
@@ -38,37 +40,35 @@ test("$.ajax() - success callbacks", function() {
     }, 13);
 });
 
-if ( !isLocal ) {
-       test("$.ajax() - error callbacks", function() {
-               expect( 8 );
-               stop();
-               
-               $('#foo').ajaxStart(function(){
-                       ok( true, "ajaxStart" );
-               }).ajaxStop(function(){
-                       ok( true, "ajaxStop" );
-                       start();
-               }).ajaxSend(function(){
-                       ok( true, "ajaxSend" );
-               }).ajaxComplete(function(){
-                       ok( true, "ajaxComplete" );
-               }).ajaxError(function(){
-                       ok( true, "ajaxError" );
-               }).ajaxSuccess(function(){
-                       ok( false, "ajaxSuccess" );
-               });
-               
-               $.ajaxSetup({ timeout: 500 });
-               
-               $.ajax({
-                       url: url("data/name.php?wait=5"),
-                       beforeSend: function(){ ok(true, "beforeSend"); },
-                       success: function(){ ok(false, "success"); },
-                       error: function(){ ok(true, "error"); },
-                       complete: function(){ ok(true, "complete"); }
-               });
-       });
-}
+test("$.ajax() - error callbacks", function() {
+    expect( 8 );
+    stop();
+    
+    $('#foo').ajaxStart(function(){
+        ok( true, "ajaxStart" );
+    }).ajaxStop(function(){
+        ok( true, "ajaxStop" );
+        start();
+    }).ajaxSend(function(){
+        ok( true, "ajaxSend" );
+    }).ajaxComplete(function(){
+        ok( true, "ajaxComplete" );
+    }).ajaxError(function(){
+        ok( true, "ajaxError" );
+    }).ajaxSuccess(function(){
+        ok( false, "ajaxSuccess" );
+    });
+    
+    $.ajaxSetup({ timeout: 500 });
+    
+    $.ajax({
+        url: url("data/name.php?wait=5"),
+        beforeSend: function(){ ok(true, "beforeSend"); },
+        success: function(){ ok(false, "success"); },
+        error: function(){ ok(true, "error"); },
+        complete: function(){ ok(true, "complete"); }
+    });
+});
 
 test("$.ajax() - disabled globals", function() {
        expect( 3 );
@@ -166,11 +166,11 @@ test("serialize()", function() {
        expect(6);
        
        equals( $('#form').serialize(),
-               "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1",
+               "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2",
                'Check form serialization as query string');
                
        equals( $('#form :input').serialize(),
-               "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1",
+               "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2",
                'Check input serialization as query string');
        
        equals( $('#testForm').serialize(), 
@@ -182,11 +182,11 @@ test("serialize()", function() {
                'Check input serialization as query string');
                
        equals( $('#form, #testForm').serialize(),
-               "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
+               "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
                'Multiple form serialization as query string');
                
        equals( $('#form, #testForm :input').serialize(),
-               "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=0&select3=1&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
+               "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
                'Mixed form/input serialization as query string');
 });
 
@@ -346,8 +346,6 @@ test("$.getScript(String, Function) - no callback", function() {
        $.getScript(url("data/test.js"), start);
 });
 
-if ( !isLocal ) {
-
 test("$.ajax() - JSONP, Local", function() {
        expect(7);
 
@@ -516,13 +514,20 @@ test("$.getJSON(String, Function) - JSON object", function() {
 });
 
 test("$.post(String, Hash, Function) - simple with xml", function() {
-       expect(2);
+       expect(4);
        stop();
        $.post(url("data/name.php"), {xml: "5-2"}, function(xml){
          $('math', xml).each(function() {
                    ok( $('calculation', this).text() == '5-2', 'Check for XML' );
                    ok( $('result', this).text() == '3', 'Check for XML' );
                 });
+       });
+
+       $.post(url("data/name.php?xml=5-2"), {}, function(xml){
+         $('math', xml).each(function() {
+                   ok( $('calculation', this).text() == '5-2', 'Check for XML' );
+                   ok( $('result', this).text() == '3', 'Check for XML' );
+                });
          start();
        });
 });