Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updating Loader meta tests

  • Loading branch information...
commit fb889a5c02a93ea5c074ff9d07676a62edf03573 1 parent bc11094
@davglass davglass authored
View
3  .gitignore
@@ -11,6 +11,7 @@ CVS/
src/build.log
.com.apple.timemachine.supported
src/out
+node_modules
api-js/
build/autocomplete-base/assets/autocomplete-list-core.css
build/autocomplete-filters-accentfold/assets/autocomplete-list-core.css
@@ -19,4 +20,4 @@ build/autocomplete-highlighters-accentfold/assets/autocomplete-list-core.css
build/autocomplete-highlighters/assets/autocomplete-list-core.css
build/autocomplete-list-keys/assets/autocomplete-list-core.css
build/autocomplete-plugin/assets/autocomplete-list-core.css
-build/autocomplete-sources/assets/autocomplete-list-core.css
+build/autocomplete-sources/assets/autocomplete-list-core.css
View
3  src/loader/tests/rls/README
@@ -1,3 +0,0 @@
-WARNING!!
-
-This test requires a local install of the RLS/YLS server, all tests will fail without it.
View
3  src/loader/tests/rls/bar.js
@@ -1,3 +0,0 @@
-YUI.add('bar', function(Y) {
- //console.log('BAR LOADED');
-}, '1.0', { requires: ['yql'] });
View
3  src/loader/tests/rls/bar2.js
@@ -1,3 +0,0 @@
-YUI.add('bar2', function(Y) {
- //console.log('BAR 2 LOADED');
-}, '1.0', { requires: ['yql', 'foo'] });
View
3  src/loader/tests/rls/baz.js
@@ -1,3 +0,0 @@
-YUI.add('baz', function(Y) {
- //console.log('BAZ LOADED');
-}, '1.0', { requires: ['console'] });
View
3  src/loader/tests/rls/foo.js
@@ -1,3 +0,0 @@
-YUI.add('foo', function(Y) {
- //console.log('FOO LOADED');
-}, '1.0', { requires: ['io-base'] });
View
3  src/loader/tests/rls/group1.js
@@ -1,3 +0,0 @@
-YUI.add('group1', function(Y) {
- //console.log('GROUP1 LOADED');
-}, '1.0', { requires: ['node'] });
View
178 src/loader/tests/rls/index.html
@@ -1,178 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>RLS Testing</title>
-</head>
-<body>
-
-<script src="../../../../build/yui/yui-rls-debug.js"></script>
-<script src="baz.js"></script>
-<script>
-var max = 1,
- results = [];
-
-var check = function() {
- if (results.length === max) {
- YUI().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)) + ']');
- Y.Assert.areEqual(0, v.m, v.name + ' has missing ATTACHED modules');
- };
- })(v);
- });
- s.add(new Y.Test.Case(cases));
- Y.Test.Runner.add(s);
- Y.Test.Runner.run();
- });
- }
-};
-
-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];
- if (Y.Env._attached[k]) {
- a.push(k);
- } else {
- m.push(k);
- }
- }
-
- var res = {
- name: 'Test ' + str,
- missed: Y.Env._missed,
- m: m
- };
-
- if (res.missed.length) {
- console.error(str, 'Missing LOADED modules', res.missed);
- }
-
- if (res.m.length) {
- console.error(str, 'Missing ATTACHED modules', res.missed);
- }
-
- if (!res.m.length && !res.missed.length) {
- console.info(str, ' is OK!');
- }
-
- results.push(res);
- //check();
-};
-
-var rls_base = 'http://localhost:3000/load?';
-
-YUI({
- rls_base: rls_base
-}).use('node', 'yql', function(Y) {
- has('#1', Y, ['node-base', 'yql']);
-});
-
-YUI({
- rls_base: rls_base
-}).use('dd', function(Y) {
- has('#2', Y, 'dd-ddm');
-});
-YUI({
- rls_base: rls_base
-}).use('yql', 'node', function(Y) {
- has('#3', Y, ['yql', 'node-base']);
-});
-
-YUI({
- rls_base: rls_base
-}).use('node', function(Y) {
- has('#4', Y, ['node-base']);
-});
-YUI({
- rls_base: rls_base,
- modules: {
- foo: {
- fullpath: 'foo.js',
- requires: ['io-base', 'querystring-stringify-simple'] //querystring-stringify-simple should not be here in 3.4.0!
- },
- bar: {
- fullpath: 'bar.js',
- requires: ['yql']
- }
- }
-}).use('foo', function(Y) {
- has('#5', Y, ['foo', 'io-base']);
-});
-
-YUI({
- rls_base: rls_base,
- modules: {
- foo: {
- fullpath: 'foo.js',
- requires: ['io-base', 'querystring-stringify-simple'] //querystring-stringify-simple should not be here in 3.4.0!
- },
- bar2: {
- fullpath: 'bar2.js',
- requires: ['yql', 'foo']
- }
- }
-}).use('bar2', function(Y) {
- //console.log('#6 keys:', Y.Object.keys(Y.Env._attached).sort());
- has('#6', Y, ['bar2', 'yql', 'foo', 'io-base']);
-});
-
-YUI({
- rls_base: rls_base,
- modules: {
- foo: {
- fullpath: 'foo.js',
- requires: ['io-base', 'querystring-stringify-simple'] //querystring-stringify-simple should not be here in 3.4.0!
- },
- bar: {
- fullpath: 'bar.js',
- requires: ['yql', 'foo']
- }
- }
-}).use('baz', function(Y) {
- //console.log('#7 keys:', Y.Object.keys(Y.Env._attached).sort());
- has('#7', Y, ['baz', 'console']);
-});
-
-YUI({
- rls_base: rls_base
-}).use('gallery-torelativetime', function(Y) {
- //console.log('#8 keys:', Y.Object.keys(Y.Env._attached).sort());
- has('#8', Y, ['gallery-torelativetime', 'loader-base']);
-});
-
-YUI({
- rls_base: rls_base
-}).use('autocomplete', function(Y) {
- //console.log('#9 keys:', Y.Object.keys(Y.Env._attached).sort());
- has('#9', Y, ['autocomplete-base', 'autocomplete-list', 'autocomplete-plugin']);
-});
-
-YUI({
- rls_base: rls_base
-}).use('widget', function(Y) {
- //console.log('#10 keys:', Y.Object.keys(Y.Env._attached).sort());
- has('#10', Y, ['widget', 'base-base']);
-});
-
-YUI({
- rls_base: rls_base,
- combine: true
-}).use('yui2-datatable', 'dd', function(Y) {
- //console.log('#11 keys:', Y.Object.keys(Y.Env._attached).sort());
- has('#11', Y, ['dd-drag', 'yui2-datatable']);
-});
-
-</script>
-</body>
-</html>
View
53 src/loader/tests/server/rls_template.html
@@ -1,53 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>RLS Test for {KEY}</title>
-</head>
-<body>
-<h1>RLS Test for {KEY}</h1>
-<script src="/build/yui-rls/yui-rls.js"></script>
-<script>
-var sendResult = function(d) {
- if (parent.window && parent.window._yui_result) {
- parent.window._yui_result(d);
- } else {
- console.log('FAILED!!');
- console.log(d);
- }
-};
-try {
- YUI({
- useBrowserConsole: false,
- use_rls: true,
- rls_base: 'http://localhost:3000/load?' //Default RLS server setting
- }).use('{KEY_USE}', function(Y) {
- sendResult({
- name: '{KEY}',
- result: Y.Env._missed,
- err: null
- });
- });
-} catch (e) {
- sendResult({
- name: '{KEY}',
- result: [],
- err: e
- });
-}
-setTimeout(function() {
- sendResult({
- name: '{KEY}',
- result: [],
- err: 'Module failed to load, error from timeout'
- });
-}, 5000);
-window.onerror = function(e) {
- sendResult({
- name: '{KEY}',
- result: [],
- err: e
- });
-}
-</script>
-</body>
-</html>
View
55 src/loader/tests/server/server.js
@@ -1,16 +1,10 @@
#!/usr/bin/env node
-//This is a hack for global modules in npm 1.0
-require.paths.push('/usr/local/lib/node_modules');
-
var tests = {};
if ('COMBO' in process.env) {
tests.combo = true;
}
-if ('RLS' in process.env) {
- tests.rls = true;
-}
if ('STAR' in process.env) {
tests.star = true;
@@ -31,13 +25,11 @@ if ('FILTER' in process.env) {
}
if (!Object.keys(tests).length) {
- console.error('NO TEST SPECIFIED: RLS, STAR, LOCAL, COMBO');
+ console.error('NO TEST SPECIFIED: STAR, LOCAL, COMBO');
console.error('export STAR=1; ./server.js');
console.error('export LOCAL=1; export STAR=1; ./server.js');
console.error('export LOCAL=1; export STAR=1; export COMBO=1; ./server.js');
console.error('export LOCAL=1; export STAR=1; export COMBO=1; export LOADER=1; ./server.js #The normal test to run');
- console.error('export LOCAL=1; export STAR=1; export COMBO=1; export RLS=1; ./server.js');
- console.error('export LOCAL=1; export STAR=1; export COMBO=1; export LOADER=1; export RLS=1; ./server.js');
process.exit(1);
}
@@ -47,15 +39,19 @@ var fs = require('fs'),
express = require('express'),
app = express.createServer(),
path = require('path'),
- yui3 = require('yui3'),
+ YUI = require(path.join(__dirname, '../../../../build/yui-nodejs/yui-nodejs')).YUI,
comboHandler = require('combohandler'),
- mods = {};
+ mods = {},
+ Y;
+
+ YUI().use('loader', function(iY) {
+ Y = iY;
+ });
} catch (e) {
console.error('Express and YUI3 need to be installed globally:');
- console.error(' npm -g i yui3');
- console.error(' npm -g i express');
- console.error(' npm -g i combohandler');
+ console.error(' npm i express');
+ console.error(' npm i combohandler');
process.exit(1);
}
@@ -104,24 +100,21 @@ Object.keys(json).forEach(function(v) {
});
var writeTest = function(key, cb) {
- var p = path.join(__dirname, "../../../../");
- var YUI = yui3.configure({ debug: false, yuiPath: p, yuiCoreFile: 'build/yui-base/yui-base.js' }).YUI;
-
- var config = {
- m: key,
- v: '3.3.0',
- env: 'features,get,intl-base,yui,yui-base,yui-later,yui-log'
- };
-
- var rls = new yui3.RLS(YUI, config);
- rls.compile(function(err, data) {
- var str = [];
- data.js.forEach(function(v) {
- str.push(fs.readFileSync(v, 'utf-8'));
- });
- cb(str.join('\n'));
+
+ var loader = new Y.Loader({
+ base: path.join(__dirname, '../../../../build/'),
+ ignoreRegistered: true,
+ ignore: [ 'features','get','intl-base','yui','yui-base','yui-later','yui-log'],
+ require: [ key ]
+ });
+
+ var out = loader.resolve(true);
+ var str = [];
+ out.js.forEach(function(v) {
+ str.push(fs.readFileSync(v, 'utf-8'));
});
-
+ cb(str.join('\n'));
+
};
var cases = [];
Please sign in to comment.
Something went wrong with that request. Please try again.