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).
This commit is contained in:
John Resig 2007-08-19 23:37:26 +00:00
parent 24db022ba0
commit 2ef4093cf7
14 changed files with 368 additions and 277 deletions

View file

@ -13,6 +13,8 @@ var _config = {
asyncTimeout: 2 // seconds for async timeout
};
var isLocal = !!(window.location.protocol == 'file:');
$(function() {
$('#userAgent').html(navigator.userAgent);
runTest();
@ -39,13 +41,17 @@ function stop(allowFailure) {
ok( false, "Test timed out" );
start();
};
_config.timeout = setTimeout(handler, _config.asyncTimeout * 1000);
// Disabled, caused too many random errors
//_config.timeout = setTimeout(handler, _config.asyncTimeout * 1000);
}
function start() {
if(_config.timeout)
clearTimeout(_config.timeout);
_config.blocking = false;
process();
// A slight delay, to avoid any current callbacks
setTimeout(function(){
if(_config.timeout)
clearTimeout(_config.timeout);
_config.blocking = false;
process();
}, 13);
}
function runTest() {
@ -271,7 +277,7 @@ function url(value) {
* @param Object actual
* @param String message (optional)
*/
function equals(expected, actual, message) {
function equals(actual, expected, message) {
var result = expected == actual;
message = message || (result ? "okay" : "failed");
_config.Test.push( [ result, result ? message + ": " + expected : message + " expected: " + expected + " actual: " + actual ] );