Updated testsuite: To prevent crashes in Safari, each test waits for 250 milliseconds before running the next

This commit is contained in:
Jörn Zaefferer 2007-01-14 22:36:54 +00:00
parent cd2bc21981
commit c6a893b680
2 changed files with 16 additions and 2 deletions

View file

@ -15,6 +15,8 @@ var _config = {
$(function() { $(function() {
$('#userAgent').html(navigator.userAgent); $('#userAgent').html(navigator.userAgent);
if($.browser.safari)
$("h1").append(" - Slowed down for Safari to prevent crashes");
runTest(); runTest();
}); });
@ -63,9 +65,18 @@ function runTest() {
}); });
} }
function test(name, callback) { function test(name, callback, nowait) {
// safari seems to have some memory problems, so we need to slow it down
if($.browser.safari && !nowait) {
test("", function() {
stop();
setTimeout(start, 250);
}, true);
}
if(_config.currentModule) if(_config.currentModule)
name = _config.currentModule + " module: " + name; name = _config.currentModule + " module: " + name;
synchronize(function() { synchronize(function() {
_config.Test = []; _config.Test = [];
try { try {
@ -82,6 +93,9 @@ function test(name, callback) {
synchronize(function() { synchronize(function() {
reset(); reset();
// don't output pause tests
if(nowait) return;
if(_config.expected && _config.expected != _config.Test.length) { if(_config.expected && _config.expected != _config.Test.length) {
_config.Test.push( [ false, "Expected " + _config.expected + " assertions, but " + _config.Test.length + " were run" ] ); _config.Test.push( [ false, "Expected " + _config.expected + " assertions, but " + _config.Test.length + " were run" ] );
} }

View file

@ -12,7 +12,7 @@
</head> </head>
<body id="body"> <body id="body">
<h1>jQuery Test Suite - Core</h1> <h1>jQuery Test Suite</h1>
<h2 id="banner"></h2> <h2 id="banner"></h2>
<h2 id="userAgent"></h2> <h2 id="userAgent"></h2>