Bug Tracker

Changeset 2783

Show
Ignore:
Timestamp:
08/19/07 23:37:26 (1 year ago)
Author:
jeresig
Message:

Complete overhaul of the Ajax test suite, it's now passing in all browsers. In order to achieve this I had to fix a numbe
r of bugs in the suite itself, along with other random bugs that popped up. The following bugs were resolved along the wa
y: #1236 (.extend() keeps processing when it hits nulls), #1028 (.extend() now works recursively), #1080 ($.get no longer

overwrites the data parameter), #1210 (Creating script and link tags now work), and #1463 (jQuery.global has been re-too

led to no longer leak memory and slow things down).

Location:
trunk/jquery
Files:
1 added
10 modified
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/jquery/build/runtest/test.js

    r2292 r2783  
    1212        "src/jquery/coreTest.js", 
    1313        "src/selector/selectorTest.js", 
    14         "src/event/eventTest.js", 
    15         "src/fx/fxTest.js" 
     14        "src/event/eventTest.js" 
     15        //"src/fx/fxTest.js", 
    1616        //"src/ajax/ajaxTest.js" 
    1717    ); 
  • trunk/jquery/build/test/data/test.js

    r612 r2783  
    1 foobar = "bar"; 
     1var foobar = "bar"; 
    22$('#ap').html('bar'); 
    33ok( true, "test.js executed"); 
  • trunk/jquery/build/test/data/test2.html

    r814 r2783  
    11<script type="text/javascript"> 
    2 testFoo = "foo"; $('#foo').html('foo');ok( true, "test2.php executed" ); 
     2var testFoo = "foo"; 
     3$('#foo').html('foo'); 
     4ok( true, "test2.html executed" ); 
    35</script> 
  • trunk/jquery/build/test/data/testrunner.js

    r2123 r2783  
    1414}; 
    1515 
     16var isLocal = !!(window.location.protocol == 'file:'); 
     17 
    1618$(function() { 
    1719    $('#userAgent').html(navigator.userAgent); 
     
    4042        start(); 
    4143    }; 
    42     _config.timeout = setTimeout(handler, _config.asyncTimeout * 1000); 
     44    // Disabled, caused too many random errors 
     45    //_config.timeout = setTimeout(handler, _config.asyncTimeout * 1000); 
    4346} 
    4447function start() { 
    45     if(_config.timeout) 
    46         clearTimeout(_config.timeout); 
    47     _config.blocking = false; 
    48     process(); 
     48    // A slight delay, to avoid any current callbacks 
     49    setTimeout(function(){ 
     50        if(_config.timeout) 
     51            clearTimeout(_config.timeout); 
     52        _config.blocking = false; 
     53        process(); 
     54    }, 13); 
    4955} 
    5056 
     
    272278 * @param String message (optional) 
    273279 */ 
    274 function equals(expected, actual, message) { 
     280function equals(actual, expected, message) { 
    275281    var result = expected == actual; 
    276282    message = message || (result ? "okay" : "failed"); 
  • trunk/jquery/build/test/index.html

    r2769 r2783  
    1010    <script type="text/javascript" src="../src/selector/selectorTest.js"></script> 
    1111    <script type="text/javascript" src="../src/event/eventTest.js"></script> 
    12     <!--<script type="text/javascript" src="../src/ajax/ajaxTest.js"></script>--> 
     12    <script type="text/javascript" src="../src/ajax/ajaxTest.js"></script> 
    1313    <script type="text/javascript" src="../src/fx/fxTest.js"></script> 
    1414</head> 
  • trunk/jquery/src/ajax/ajax.js

    r2770 r2783  
    8080                    self.html(res.responseText); 
    8181 
    82                 self.each( callback, [res.responseText, status, res] ); 
     82                // Add delay to account for Safari's delay in globalEval 
     83                setTimeout(function(){ 
     84                    self.each( callback, [res.responseText, status, res] ); 
     85                }, 13); 
    8386            } 
    8487        }); 
     
    571574     */ 
    572575    ajax: function( s ) { 
    573         // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout 
    574         s = jQuery.extend({}, jQuery.ajaxSettings, s); 
     576        // Extend the settings, but re-extend 's' so that it can be 
     577        // checked again later (in the test suite, specifically) 
     578        s = jQuery.extend(s, jQuery.extend({}, jQuery.ajaxSettings, s)); 
    575579 
    576580        // if data available 
    577581        if ( s.data ) { 
    578582            // convert data if not already a string 
    579             if (s.processData && typeof s.data != "string") 
    580                 s.data = jQuery.param(s.data); 
     583            if ( s.processData && typeof s.data != "string" ) 
     584                s.data = jQuery.param(s.data); 
     585 
    581586            // append data to url for get requests 
    582             if( s.type.toLowerCase() == "get" ) { 
     587            if ( s.type.toLowerCase() == "get" ) { 
    583588                // "?" + data or "&" + data (in case there are already params) 
    584                 s.url += ((s.url.indexOf("?") > -1) ? "&" : "?") + s.data; 
     589                s.url += (s.url.indexOf("?") > -1 ? "&" : "?") + s.data; 
     590 
    585591                // IE likes to send both get and post data, prevent this 
    586592                s.data = null; 
     
    663669     
    664670                    // Fire the global callback 
    665                     if( s.global ) 
     671                    if ( s.global ) 
    666672                        jQuery.event.trigger( "ajaxSuccess", [xml, s] ); 
    667673                } else 
     
    686692        }; 
    687693         
    688         // don't attach the handler to the request, just poll it instead 
    689         var ival = setInterval(onreadystatechange, 13);  
    690  
    691         // Timeout checker 
    692         if ( s.timeout > 0 ) 
    693             setTimeout(function(){ 
    694                 // Check to see if the request is still happening 
    695                 if ( xml ) { 
    696                     // Cancel the request 
    697                     xml.abort(); 
    698  
    699                     if( !requestDone ) 
    700                         onreadystatechange( "timeout" ); 
    701                 } 
    702             }, s.timeout); 
     694        if ( s.async ) { 
     695            // don't attach the handler to the request, just poll it instead 
     696            var ival = setInterval(onreadystatechange, 13);  
     697 
     698            // Timeout checker 
     699            if ( s.timeout > 0 ) 
     700                setTimeout(function(){ 
     701                    // Check to see if the request is still happening 
     702                    if ( xml ) { 
     703                        // Cancel the request 
     704                        xml.abort(); 
     705     
     706                        if( !requestDone ) 
     707                            onreadystatechange( "timeout" ); 
     708                    } 
     709                }, s.timeout); 
     710        } 
    703711             
    704712        // Send the data 
  • trunk/jquery/src/ajax/ajaxTest.js

    r2286 r2783  
    11module("ajax"); 
    22 
     3// Safari 3 crashes when running these tests, sigh 
     4if ( !jQuery.browser.safari ) { 
     5 
    36test("serialize()", function() { 
    47    expect(1); 
    5     var data = $(':input').not('button').serialize(); 
    68    // ignore button, IE takes text content as value, not relevant for this test 
    7     ok( data == 'action=Test&text2=Test&radio1=on&radio2=on&check=on&=on&hidden=&foo%5Bbar%5D=&name=name&=foobar&select1=&select2=3&select3=1', 'Check form serialization as query string' ); 
    8 }); 
    9  
    10 test("param", function() { 
     9    equals( $(':input').not('button').serialize(),  
     10        'action=Test&text2=Test&radio1=on&radio2=on&check=on&=on&hidden=&foo%5Bbar%5D=&name=name&=foobar&select1=&select2=3&select3=1&test=&id=',  
     11        'Check form serialization as query string'); 
     12}); 
     13 
     14test("$.param()", function() { 
    1115    expect(4); 
    1216    var params = {foo:"bar", baz:42, quux:"All your base are belong to us"}; 
    13     ok( $.param(params) == "foo=bar&baz=42&quux=All%20your%20base%20are%20belong%20to%20us", "simple" ); 
     17    equals( $.param(params), "foo=bar&baz=42&quux=All%20your%20base%20are%20belong%20to%20us", "simple" ); 
    1418     
    1519    params = {someName: [1, 2, 3], regularThing: "blah" }; 
    16     ok( $.param(params) == "someName=1&someName=2&someName=3&regularThing=blah", "with array" ); 
     20    equals( $.param(params), "someName=1&someName=2&someName=3&regularThing=blah", "with array" ); 
    1721     
    1822    params = {"foo[]":["baz", 42, "All your base are belong to us"]}; 
    19     ok( $.param(params) == "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All%20your%20base%20are%20belong%20to%20us", "more array" ); 
     23    equals( $.param(params), "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All%20your%20base%20are%20belong%20to%20us", "more array" ); 
    2024     
    2125    params = {"foo[bar]":"baz", "foo[beep]":42, "foo[quux]":"All your base are belong to us"}; 
    22     ok( $.param(params) == "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All%20your%20base%20are%20belong%20to%20us", "even more arrays" ); 
    23 }); 
    24  
    25 test("evalScripts() with no script elements", function() { 
    26     expect(2); 
    27  
    28     var data = "this is just some bogus text"; 
    29     $('#foo').html(data); 
    30     ok ( true, 'before evalScripts()'); 
    31     try { 
    32         $('#foo').evalScripts(); 
    33     } catch(e) { 
    34         ok (false, 'exception evaluating scripts: ' + e.message); 
    35     } 
    36     ok ( true, 'after evalScripts()'); 
     26    equals( $.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All%20your%20base%20are%20belong%20to%20us", "even more arrays" ); 
    3727}); 
    3828 
    3929test("synchronous request", function() { 
     30    expect(1); 
    4031    ok( /^{ "data"/.test( $.ajax({url: url("data/json_obj.js"), async: false}).responseText ), "check returned text" ); 
    4132}); 
     
    5142    expect(7); 
    5243    stop(true); 
     44     
     45    var target = "data/name.html"; 
    5346    var count = 0; 
    5447    var success = function() { 
    55         if(count++ == 6) 
    56             start(); 
    57     } 
    58     var target = "data/name.html"; 
     48        if(count++ == 5) 
     49            start(); 
     50    }; 
     51     
    5952    ok( $.get(url(target), success), "get" ); 
    6053    ok( $.getIfModified(url(target), success), "getIfModified" ); 
     
    6558}); 
    6659 
    67 test("load(String, Object, Function) - simple: inject text into DOM", function() { 
     60test("global ajaxSettings", function() { 
     61    expect(3); 
     62 
     63    var tmp = jQuery.extend({}, jQuery.ajaxSettings); 
     64        var orig = { url: "data/with_fries.xml", data: null }; 
     65    var t; 
     66 
     67    $.ajaxSetup({ data: {foo: 'bar', bar: 'BAR'} }); 
     68 
     69        t = jQuery.extend({}, orig); 
     70        $.ajax(t); 
     71    ok( t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending null" ); 
     72 
     73        t = jQuery.extend({}, orig); 
     74    t.data = {}; 
     75        $.ajax(t); 
     76    ok( t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending {}" ); 
     77 
     78        t = jQuery.extend({}, orig); 
     79    t.data = { zoo: 'a', ping: 'b' }; 
     80        $.ajax(t); 
     81    ok( t.url.indexOf('ping') > -1 && t.url.indexOf('zoo') > -1 && t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending { zoo: 'a', ping: 'b' }" ); 
     82     
     83    jQuery.ajaxSettings = tmp; 
     84}); 
     85 
     86test("load(String)", function() { 
     87    expect(1); 
     88    stop(true); // check if load can be called with only url 
     89    $('#first').load("data/name.html", start); 
     90}); 
     91 
     92test("load(String, Function) - simple: inject text into DOM", function() { 
    6893    expect(2); 
    6994    stop(); 
     
    7499}); 
    75100 
    76 test("load(String, Object, Function) - inject without callback", function() { 
    77     expect(1); 
    78     stop(true); // check if load can be called with only url 
    79     $('#first').load("data/name.html"); 
    80 }); 
    81  
    82 if ( location.protocol != "file:" ) { 
    83  
    84 test("load(String, Object, Function) - check scripts", function() { 
     101test("load(String, Function) - check scripts", function() { 
    85102    expect(7); 
    86103    stop(); 
     
    88105    window.foobar = null; 
    89106    var verifyEvaluation = function() { 
    90       ok( foobar == "bar", 'Check if script src was evaluated after load' ); 
    91       ok( $('#ap').html() == 'bar', 'Check if script evaluation has modified DOM'); 
     107      equals( foobar, "bar", 'Check if script src was evaluated after load' ); 
     108      equals( $('#ap').html(), 'bar', 'Check if script evaluation has modified DOM'); 
    92109      start(); 
    93110    }; 
    94     $('#first').load(url('data/test.php'), function() { 
     111    $('#first').load(url('data/test.html'), function() { 
    95112      ok( $('#first').html().match(/^html text/), 'Check content after loading html' ); 
     113      equals( $('#foo').html(), 'foo', 'Check if script evaluation has modified DOM'); 
     114      equals( testFoo, "foo", 'Check if script was evaluated after load' ); 
     115      setTimeout(verifyEvaluation, 600); 
     116    }); 
     117}); 
     118 
     119test("load(String, Function) - check file with only a script tag", function() { 
     120    expect(3); 
     121    stop(); 
     122    testFoo = undefined; 
     123    $('#first').load(url('data/test2.html'), function() { 
    96124      ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM'); 
    97125      ok( testFoo == "foo", 'Check if script was evaluated after load' ); 
    98       setTimeout(verifyEvaluation, 600); 
    99     }); 
    100 }); 
    101  
    102 test("load(String, Object, Function) - check file with only a script tag", function() { 
     126      start(); 
     127    }); 
     128}); 
     129 
     130test("$.get(String, Hash, Function) - parse xml and use text() on nodes", function() { 
     131    expect(2); 
     132    stop(); 
     133    $.get(url('data/dashboard.xml'), function(xml) { 
     134        var content = []; 
     135        $('tab', xml).each(function() { 
     136            content.push($(this).text()); 
     137        }); 
     138        equals( content[0], 'blabla', 'Check first tab'); 
     139        equals( content[1], 'blublu', 'Check second tab'); 
     140        start(); 
     141    }); 
     142}); 
     143 
     144test("$.getIfModified(String, Hash, Function)", function() { 
     145    expect(1); 
     146    stop(); 
     147    $.getIfModified(url("data/name.html"), function(msg) { 
     148        ok( /^ERROR/.test(msg), 'Check ifModified' ); 
     149        start(); 
     150    }); 
     151}); 
     152 
     153test("$.getScript(String, Function) - with callback", function() { 
     154    expect(2); 
     155    stop(); 
     156    $.getScript(url("data/test.js"), function() { 
     157        equals( foobar, "bar", 'Check if script was evaluated' ); 
     158        setTimeout(start, 100); 
     159    }); 
     160}); 
     161 
     162test("$.getScript(String, Function) - no callback", function() { 
     163    expect(1); 
     164    stop(true); 
     165    $.getScript(url("data/test.js"), start); 
     166}); 
     167 
     168test("$.ajax - xml: non-namespace elements inside namespaced elements", function() { 
    103169    expect(3); 
    104170    stop(); 
    105     testFoo = undefined; 
    106     $('#first').load(url('data/test2.php'), function() { 
    107       ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM'); 
    108       ok( testFoo == "foo", 'Check if script was evaluated after load' ); 
    109       start(); 
     171    $.ajax({ 
     172      url: url("data/with_fries.xml"), 
     173      dataType: "xml", 
     174      success: function(resp) { 
     175        equals( $("properties", resp).length, 1, 'properties in responseXML' ); 
     176        equals( $("jsconf", resp).length, 1, 'jsconf in responseXML' ); 
     177        equals( $("thing", resp).length, 2, 'things in responseXML' ); 
     178        start(); 
     179      } 
    110180    }); 
    111181}); 
    112182 
    113183test("test global handlers - success", function() { 
    114     expect(8); 
    115     stop(); 
     184    expect( isLocal ? 4 : 8 ); 
     185    stop(); 
     186     
    116187    var counter = { complete: 0, success: 0, error: 0, send: 0 }, 
    117188        success = function() { counter.success++ }, 
     
    121192 
    122193    $('#foo').ajaxStart(complete).ajaxStop(complete).ajaxSend(send).ajaxComplete(complete).ajaxError(error).ajaxSuccess(success); 
     194     
    123195    // start with successful test 
    124     $.ajax({url: url("data/name.php"), beforeSend: send, success: success, error: error, complete: function() { 
    125       ok( counter.error == 0, 'Check succesful request' ); 
    126       ok( counter.success == 2, 'Check succesful request' ); 
    127       ok( counter.complete == 3, 'Check succesful request' ); 
    128       ok( counter.send == 2, 'Check succesful request' ); 
    129       counter.error = counter.success = counter.complete = counter.send = 0; 
    130       $.ajaxTimeout(500); 
    131       $.ajax({url: url("data/name.php?wait=5"), beforeSend: send, success: success, error: error, complete: function() { 
    132         ok( counter.error == 2, 'Check failed request' ); 
    133         ok( counter.success == 0, 'Check failed request' ); 
    134         ok( counter.complete == 3, 'Check failed request' ); 
    135         ok( counter.send == 2, 'Check failed request' ); 
    136         start(); 
    137       }}); 
     196    $.ajax({url: url("data/name.html"), beforeSend: send, success: success, error: error, complete: function() { 
     197      equals( counter.error, 0, 'Check succesful request, error callback' ); 
     198      equals( counter.success, 2, 'Check succesful request, success callback' ); 
     199      equals( counter.complete, 3, 'Check succesful request, complete callback' ); 
     200      equals( counter.send, 2, 'Check succesful request, send callback' ); 
     201       
     202      if ( !isLocal ) { 
     203          counter.error = counter.success = counter.complete = counter.send = 0; 
     204          $.ajaxTimeout(500); 
     205           
     206          $.ajax({url: url("data/name.php?wait=5"), beforeSend: send, success: success, error: error, complete: function() { 
     207            equals( counter.error, 2, 'Check failed request, error callback' ); 
     208            equals( counter.success, 0, 'Check failed request, success callback' ); 
     209            equals( counter.complete, 3, 'Check failed request, failed callback' ); 
     210            equals( counter.send, 2, 'Check failed request, send callback' ); 
     211            start(); 
     212          }}); 
     213      } else 
     214          start(); 
    138215    }}); 
    139216}); 
    140217 
    141218test("test global handlers - failure", function() { 
    142     expect(8); 
    143     stop(); 
     219    expect( isLocal ? 4 : 8 ); 
     220    stop(); 
     221     
    144222    var counter = { complete: 0, success: 0, error: 0, send: 0 }, 
    145223        success = function() { counter.success++ }, 
     
    147225        complete = function() { counter.complete++ }, 
    148226        send = function() { counter.send++ }; 
     227         
    149228    $.ajaxTimeout(0); 
     229     
    150230    $('#foo').ajaxStart(complete).ajaxStop(complete).ajaxSend(send).ajaxComplete(complete).ajaxError(error).ajaxSuccess(success); 
     231     
    151232    $.ajax({url: url("data/name.php"), global: false, beforeSend: send, success: success, error: error, complete: function() { 
    152233      ok( counter.error == 0, 'Check sucesful request without globals' ); 
     
    154235      ok( counter.complete == 0, 'Check sucesful request without globals' ); 
    155236      ok( counter.send == 1, 'Check sucesful request without globals' ); 
    156       counter.error = counter.success = counter.complete = counter.send = 0; 
    157       $.ajaxTimeout(500); 
    158       $.ajax({url: url("data/name.php?wait=5"), global: false, beforeSend: send, success: success, error: error, complete: function() { 
    159          var x = counter; 
    160          ok( counter.error == 1, 'Check failed request without globals' ); 
    161          ok( counter.success == 0, 'Check failed request without globals' ); 
    162          ok( counter.complete == 0, 'Check failed request without globals' ); 
    163          ok( counter.send == 1, 'Check failed request without globals' ); 
    164          start(); 
    165       }}); 
     237       
     238      if ( !isLocal ) { 
     239          counter.error = counter.success = counter.complete = counter.send = 0; 
     240          $.ajaxTimeout(500); 
     241           
     242          $.ajax({url: url("data/name.php?wait=5"), global: false, beforeSend: send, success: success, error: error, complete: function() { 
     243             var x = counter; 
     244             ok( counter.error == 1, 'Check failed request without globals' ); 
     245             ok( counter.success == 0, 'Check failed request without globals' ); 
     246             ok( counter.complete == 0, 'Check failed request without globals' ); 
     247             ok( counter.send == 1, 'Check failed request without globals' ); 
     248             start(); 
     249          }}); 
     250      } else 
     251          start(); 
    166252    }}); 
    167253}); 
    168254 
    169 test("$.get(String, Hash, Function) - parse xml and use text() on nodes", function() { 
    170     expect(2); 
    171     stop(); 
    172     $.get(url('data/dashboard.xml'), function(xml) { 
    173         var content = []; 
    174         $('tab', xml).each(function() { 
    175             content.push($(this).text()); 
    176         }); 
    177         ok( content[0] == 'blabla', 'Check first tab'); 
    178         ok( content[1] == 'blublu', 'Check second tab'); 
    179         start(); 
    180     }); 
    181 }); 
    182  
    183 test("$.getIfModified(String, Hash, Function)", function() { 
    184     expect(1); 
    185     stop(); 
    186     $.getIfModified(url("data/name.php"), function(msg) { 
    187         ok( /^ERROR/.test(msg), 'Check ifModified' ); 
    188         start(); 
    189     }); 
    190 }); 
    191  
    192 test("$.getScript(String, Function) - with callback", function() { 
    193     expect(2); 
    194     stop(); 
    195     $.getScript(url("data/test.js"), function() { 
    196         ok( foobar == "bar", 'Check if script was evaluated' ); 
    197         setTimeout(start, 100); 
    198     }); 
    199 }); 
    200  
    201 test("$.getScript(String, Function) - no callback", function() { 
    202     expect(1); 
    203     stop(true); 
    204     $.getScript(url("data/test.js")); 
    205 }); 
     255test("$.ajax - beforeSend", function() { 
     256    expect(1); 
     257    stop(); 
     258     
     259    var check = false; 
     260     
     261    $.ajaxSetup({ timeout: 0 }); 
     262     
     263    $.ajax({ 
     264        url: url("data/name.html"),  
     265        beforeSend: function(xml) { 
     266            check = true; 
     267        }, 
     268        success: function(data) { 
     269            ok( check, "check beforeSend was executed" ); 
     270            start(); 
     271        } 
     272    }); 
     273}); 
     274 
     275test("$.ajax - dataType html", function() { 
     276    expect(5); 
     277    stop(); 
     278     
     279    foobar = null; 
     280    testFoo = undefined; 
     281     
     282    var verifyEvaluation = function() { 
     283      ok( foobar == "bar", 'Check if script src was evaluated for datatype html' ); 
     284      start(); 
     285    }; 
     286     
     287    $.ajax({ 
     288      dataType: "html", 
     289      url: url("data/test.html"), 
     290      success: function(data) { 
     291        $("#ap").html(data); 
     292        ok( data.match(/^html text/), 'Check content for datatype html' ); 
     293        ok( testFoo == "foo", 'Check if script was evaluated for datatype html' ); 
     294        setTimeout(verifyEvaluation, 600); 
     295      } 
     296    }); 
     297}); 
     298 
     299if ( !isLocal ) { 
    206300 
    207301test("$.getJSON(String, Hash, Function) - JSON array", function() { 
     
    217311}); 
    218312 
    219 test("$.getJSON(String, Hash, Function) - JSON object", function() { 
     313test("$.getJSON(String, Function) - JSON object", function() { 
    220314    expect(2); 
    221315    stop(); 
     
    241335test("$.ajaxTimeout(Number) - with global timeout", function() { 
    242336    stop(); 
     337     
    243338    var passed = 0; 
    244     var timeout; 
     339 
    245340    $.ajaxTimeout(1000); 
     341     
    246342    var pass = function() { 
    247343        passed++; 
    248         if(passed == 2) { 
     344        if ( passed == 2 ) { 
    249345            ok( true, 'Check local and global callbacks after timeout' ); 
    250             clearTimeout(timeout); 
    251          $('#main').unbind("ajaxError"); 
     346            $('#main').unbind("ajaxError"); 
    252347            start(); 
    253348        } 
    254349    }; 
    255     var fail = function() { 
    256         ok( false, 'Check for timeout failed' ); 
     350     
     351    var fail = function(a,b,c) { 
     352        ok( false, 'Check for timeout failed ' + a + ' ' + b ); 
    257353        start(); 
    258354    }; 
    259     timeout = setTimeout(fail, 1500); 
     355     
    260356    $('#main').ajaxError(pass); 
     357     
    261358    $.ajax({ 
    262359      type: "GET", 
     
    265362      success: fail 
    266363    }); 
     364     
    267365    // reset timeout 
    268366    $.ajaxTimeout(0); 
     
    314412    }); 
    315413}); 
    316      
    317 test("$.ajax - dataType html", function() { 
    318     expect(5); 
    319     stop(); 
    320   &n