Remove XMLHttpRequest shadowing, instead decide at runtime whether to create an Activ...
[jquery.git] / src / ajax / ajaxTest.js
index b215d95..851be51 100644 (file)
@@ -1,5 +1,7 @@
 module("ajax");
 
+if ( location.protocol != "file:" ) {
+
 test("serialize()", function() {
        expect(1);
        var data = $(':input').not('button').serialize();
@@ -68,8 +70,8 @@ test("load(String, Object, Function) - inject without callback", function() {
 test("load(String, Object, Function) - check scripts", function() {
        expect(7);
        stop();
-       testFoo = undefined;
-       foobar = null;
+       window.testFoo = undefined;
+       window.foobar = null;
        var verifyEvaluation = function() {
          ok( foobar == "bar", 'Check if script src was evaluated after load' );
          ok( $('#ap').html() == 'bar', 'Check if script evaluation has modified DOM');
@@ -376,3 +378,18 @@ test("evalScripts() with no script elements", function() {
     }
     ok ( true, 'after evalScripts()');
 });
+
+test("custom timeout does not set error message when timeout occurs, see #970", function() {
+       stop();
+       $.ajax({
+               url: "data/name.php?wait=10",
+               timeout: 500,
+               error: function(request, status) {
+                       ok( status != null, "status shouldn't be null in error handler" );
+                       equals( "timeout", status );
+                       start();
+               }
+       });
+});
+
+}