loader_template.js revision 8367c40f471b6d7692cc67b0ad710817521d835d
/*
* This file was assembled by ../scripts/build_loader_tests.js
*/
//This is a hack for global modules in npm 1.0
require.paths.push('/usr/local/lib/node_modules');
var path = require('path'),
Y = require('yui3').configure({
debug: false,
corePath: path.join(__dirname + '../../../../')
}).useSync('loader'),
YUITest = require("yuitest").YUITest,
Assert = YUITest.Assert,
ArrayAssert = YUITest.ArrayAssert,
suite = new YUITest.TestSuite("YUILoader");
//Generic Async Wait
var async = function(fn) {
var count = 0;
return function(data) {
var loaded = false;
var w = function() {
if (count === 1000) {
throw new Error('Async Timer reached 1000 iterations..');
}
count++;
if (!loaded) {
this.wait(w, 10);
}
};
var next = function() {
loaded = true;
};
fn.call(this, data, next);
this.wait(w, 10);
};
};
/*
* !! TESTCASE !! will be replaced with a JSON object by the parent script.
*/
suite.add(new YUITest.TestCase(!!TESTCASE!!));
YUITest.TestRunner.add(suite);