git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added test and check for end() when there is no stack or nothing on the stack to...
[jquery.git]
/
build
/
test
/
data
/
testrunner.js
diff --git
a/build/test/data/testrunner.js
b/build/test/data/testrunner.js
index
a72a1c1
..
cf4777d
100644
(file)
--- a/
build/test/data/testrunner.js
+++ b/
build/test/data/testrunner.js
@@
-8,6
+8,7
@@
var stats = {
};
var queue = [];
var blocking = false;
};
var queue = [];
var blocking = false;
+var timeout;
function synchronize(callback) {
queue[queue.length] = callback;
function synchronize(callback) {
queue[queue.length] = callback;
@@
-26,9
+27,11
@@
function process() {
function stop() {
blocking = true;
function stop() {
blocking = true;
- setTimeout(start, asyncTimeout * 1000);
+ timeout = setTimeout(start, asyncTimeout * 1000);
}
function start() {
}
function start() {
+ if(timeout)
+ clearTimeout(timeout);
blocking = false;
process();
}
blocking = false;
process();
}
@@
-40,19
+43,20
@@
function runTest(tests) {
synchronize(function() {
var runTime = new Date() - startTime;
var result = document.createElement("div");
synchronize(function() {
var runTime = new Date() - startTime;
var result = document.createElement("div");
- result.innerHTML = 'Tests completed in ' + runTime + ' milliseconds.<br/>' +
- stats.bad + ' tests of ' + stats.all + ' failed.';
+ result.innerHTML = '<p class="result">Tests completed in ' +
+ runTime + ' milliseconds.<br/>' +
+ stats.bad + ' tests of ' + stats.all + ' failed.</p>';
document.getElementsByTagName("body")[0].appendChild(result);
});
}
function test(name, callback) {
document.getElementsByTagName("body")[0].appendChild(result);
});
}
function test(name, callback) {
- Test = [];
synchronize(function() {
synchronize(function() {
+ Test = [];
try {
callback();
} catch(e) {
try {
callback();
} catch(e) {
- if(typeof console != "undefined") {
+ if( typeof console != "undefined" && console.error && console.warn ) {
console.error("Test " + name + " died, exception and test follows");
console.error(e);
console.warn(callback.toString());
console.error("Test " + name + " died, exception and test follows");
console.error(e);
console.warn(callback.toString());
@@
-65,7
+69,7
@@
function test(name, callback) {
var good = 0, bad = 0;
var ol = document.createElement("ol");
var good = 0, bad = 0;
var ol = document.createElement("ol");
-
+ ol.style.display = "none";
var li = "", state = "pass";
for ( var i = 0; i < Test.length; i++ ) {
var li = document.createElement("li");
var li = "", state = "pass";
for ( var i = 0; i < Test.length; i++ ) {
var li = document.createElement("li");
@@
-126,9
+130,10
@@
function isSet(a, b, msg) {
ret = false;
} else
ret = false;
ret = false;
} else
ret = false;
- if ( !ret && console )
- console.log( msg, a, b );
- Test.push( [ ret, msg ] );
+ if ( !ret )
+ Test.push( [ ret, msg + " expected: " + b + " result: " + a ] );
+ else
+ Test.push( [ ret, msg ] );
}
/**
}
/**