forked from jeresig/env-js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jquery 1.4.1 integration test patches, loading but not yet running
- Loading branch information
thatcher
committed
Feb 9, 2010
1 parent
0278d78
commit d3ef20e
Showing
19 changed files
with
280 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
//debugger; | ||
load("dist/env.rhino.js"); | ||
|
||
Envjs({ | ||
//let it load the script from the html | ||
scriptTypes: { | ||
"text/javascript" :true | ||
}, | ||
afterScriptLoad:{ | ||
'qunit/testrunner.js': function(){ | ||
//hook into qunit.log | ||
var count = 0; | ||
QUnit.log = function(result, message){ | ||
console.log('(' + (count++) + ')[' + | ||
((!!result) ? 'PASS' : 'FAIL') + '] ' + message); | ||
}; | ||
//hook into qunit.done | ||
QUnit.done = function(pass, fail){ | ||
console.log('Writing Results to File'); | ||
jQuery('script').each(function(){ | ||
this.type = 'text/envjs'; | ||
}); | ||
Envjs.writeToFile( | ||
document.documentElement.xml, | ||
Envjs.location('jqenv-'+Date.now()+'.html') | ||
); | ||
}; | ||
|
||
//allow jquery to run ajax | ||
isLocal = false; | ||
|
||
|
||
var unsafeStop = stop, | ||
unsafeStart = start, | ||
isStopped = null; | ||
|
||
var config_timeout; | ||
stop = function(timeout){ | ||
if(isStopped === null || isStopped === false){ | ||
console.log('PAUSING QUNIT'); | ||
isStopped = true; | ||
unsafeStop.call(this); | ||
timeout = ( timeout && timeout > 0 ) ? timeout : 10000; | ||
/*if (timeout) | ||
config_timeout = setTimeout(function() { | ||
QUnit.ok( false, "Test timed out" ); | ||
start(); | ||
}, timeout);*/ | ||
Envjs.wait() | ||
} | ||
}; | ||
start = function(){ | ||
if(isStopped === null || isStopped === true ){ | ||
console.log('RESTARTING QUNIT'); | ||
isStopped = false; | ||
if(config_timeout) { | ||
clearTimeout(config_timeout); | ||
config_timeout = undefined; | ||
} | ||
unsafeStart.call(this); | ||
} | ||
}; | ||
//we know some ajax calls will fail becuase | ||
//we are not running against a running server | ||
//for php files | ||
var handleError = jQuery.handleError; | ||
jQuery.handleError = function(){ | ||
ok(false, 'Ajax may have failed while running locally'); | ||
try{ | ||
handleError(arguments); | ||
}catch(e){} | ||
//allow tests to gracefully continue | ||
start(); | ||
}; | ||
//allow unanticipated xhr error with no ajax.handleError | ||
//callback (eg jQuery.getScript) to exit gracefully | ||
Envjs.onInterrupt = function(){ | ||
console.log('thread interupt: gracefully continuing test'); | ||
start(); | ||
}; | ||
|
||
|
||
Envjs.onScriptLoadError = function(script){ | ||
Envjs.error("failed to load script \n"+script.text); | ||
ok(false, 'Ajax may have failed to load correct script while running locally'); | ||
//allow tests to gracefully continue | ||
start(); | ||
}; | ||
} | ||
} | ||
}); | ||
|
||
window.document.async = false; | ||
window.location = 'test/vendor/jQuery/1.4.1/test/index.html'; | ||
Envjs.wait(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.