index.html revision b47f230a8ee484efe376ea0ed2d1d3837e71f6c2
<!doctype html>
<html>
<head>
<title>RLS Testing</title>
</head>
<body>
<script>
var max = 11,
results = [];
var check = function() {
if (results.length === max) {
YUI({
use_rls: true,
rls_base: rls_base
}).use('test', function(Y) {
var s = new Y.Test.Suite("Dynamic Use");
var cases = {
name: 'Local RLS Tests'
};
Y.each(results, function(v) {
var name = v.name.replace(/ /g, '_').replace(/#/, '').toLowerCase();
cases[name] = (function(v) {
return function() {
Y.Assert.areEqual(0, v.missed.length, v.name + ' has missing LOADED modules: [' + Y.Object.keys(Y.Array.hash(v.missed)) + ']');
};
})(v);
});
s.add(new Y.Test.Case(cases));
});
}
};
var has = function(str, Y, mod) {
var a = [], m = [];
if (!(mod instanceof Array)) {
mod = [mod];
}
for (var i = 0; i < mod.length; i++) {
var k = mod[i];
a.push(k);
} else {
m.push(k);
}
}
var res = {
name: 'Test ' + str,
missed: Y.Env._missed,
m: m
};
results.push(res);
check();
};
var rls_base = 'http://localhost:3000/load?';
YUI({
use_rls: true,
rls_base: rls_base
}).use('node', 'yql', function(Y) {
has('#1', Y, ['node', 'yql']);
});
YUI({
use_rls: true,
rls_base: rls_base
}).use('dd', function(Y) {
has('#2', Y, 'dd');
});
YUI({
use_rls: true,
rls_base: rls_base
}).use('yql', 'node', function(Y) {
has('#3', Y, ['yql', 'node']);
});
YUI({
use_rls: true,
rls_base: rls_base
}).use('node', function(Y) {
has('#4', Y, ['node']);
});
YUI({
use_rls: true,
rls_base: rls_base,
modules: {
foo: {
fullpath: 'foo.js',
requires: ['io-base']
},
bar: {
fullpath: 'bar.js',
requires: ['yql']
}
}
}).use('foo', function(Y) {
has('#5', Y, ['foo', 'io-base']);
});
YUI({
use_rls: true,
rls_base: rls_base,
modules: {
foo: {
fullpath: 'foo.js',
requires: ['io-base']
},
bar2: {
fullpath: 'bar2.js',
requires: ['yql', 'foo']
}
}
}).use('bar2', function(Y) {
has('#6', Y, ['bar2', 'yql', 'foo', 'io-base']);
});
YUI({
use_rls: true,
rls_base: rls_base,
modules: {
foo: {
fullpath: 'foo.js',
requires: ['io-base']
},
bar: {
fullpath: 'bar.js',
requires: ['yql', 'foo']
}
}
}).use('baz', function(Y) {
has('#7', Y, ['baz', 'console']);
});
YUI({
use_rls: true,
rls_base: rls_base
}).use('gallery-torelativetime', function(Y) {
has('#8', Y, ['gallery-torelativetime', 'loader-base']);
});
YUI({
use_rls: true,
rls_base: rls_base
}).use('autocomplete', function(Y) {
has('#9', Y, ['autocomplete-base', 'autocomplete-list', 'autocomplete-plugin']);
});
YUI({
use_rls: true,
rls_base: rls_base
}).use('widget', function(Y) {
has('#10', Y, ['widget', 'base-base']);
});
YUI({
use_rls: true,
rls_base: rls_base,
combine: true
}).use('yui2-datatable', 'dd', function(Y) {
has('#11', Y, ['dd', 'yui2-datatable']);
});
</script>
</body>
</html>