loader-tests.js revision 618fb4ad3b6a85d7f7bc71436ab32b1ee241210f
dbb33756bd786e9432e18ec7be93f8c416e1b492Jon A. CruzYUI.add('loader-tests', function(Y) {
dbb33756bd786e9432e18ec7be93f8c416e1b492Jon A. Cruz
dbb33756bd786e9432e18ec7be93f8c416e1b492Jon A. Cruz var Assert = Y.Assert,
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould testY = YUI();
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var testLoader = new Y.Test.Case({
23d859f2ce09c04ed802cb4912cc9c50f512f0a2bgk
23d859f2ce09c04ed802cb4912cc9c50f512f0a2bgk name: "Loader Tests",
9dc68827cbd515262ecb8d5ae8547d9e82c72e00Jon A. Cruz
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test_resolve_no_calc: function() {
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould var loader = new testY.Loader({
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm ignoreRegistered: true,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm require: ['node', 'dd', 'console']
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm });
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var out = loader.resolve();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.areEqual(0, out.js.length, 'JS files returned');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.areEqual(0, out.css.length, 'CSS files returned');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
1b3a8414f17dc95fc921d999ea715c99d10dd4aaAlex Valavanis },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test_resolve_manual_calc: function() {
035e109c2dce9f6a9552f75d09b1573311d02546tweenk var loader = new testY.Loader({
035e109c2dce9f6a9552f75d09b1573311d02546tweenk ignoreRegistered: true,
035e109c2dce9f6a9552f75d09b1573311d02546tweenk require: ['node', 'dd', 'console']
035e109c2dce9f6a9552f75d09b1573311d02546tweenk });
035e109c2dce9f6a9552f75d09b1573311d02546tweenk loader.calculate();
035e109c2dce9f6a9552f75d09b1573311d02546tweenk var out = loader.resolve();
035e109c2dce9f6a9552f75d09b1573311d02546tweenk Assert.isTrue((out.js.length > 0), 'NO JS files returned');
47badd0035ae8c9135c51444f3770b17ae504ddaAlex Valavanis Assert.isTrue((out.css.length > 0), 'NO CSS files returned');
035e109c2dce9f6a9552f75d09b1573311d02546tweenk },
035e109c2dce9f6a9552f75d09b1573311d02546tweenk test_resolve_auto_calc: function() {
035e109c2dce9f6a9552f75d09b1573311d02546tweenk var loader = new testY.Loader({
035e109c2dce9f6a9552f75d09b1573311d02546tweenk ignoreRegistered: true,
035e109c2dce9f6a9552f75d09b1573311d02546tweenk require: ['node', 'dd', 'console']
035e109c2dce9f6a9552f75d09b1573311d02546tweenk });
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen var out = loader.resolve(true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue((out.js.length > 0), 'NO JS files returned');
23d859f2ce09c04ed802cb4912cc9c50f512f0a2bgk Assert.isTrue((out.css.length > 0), 'NO CSS files returned');
035e109c2dce9f6a9552f75d09b1573311d02546tweenk },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test_resolve_combo: function() {
ae22ad7adc4a7a418e71f5dbab8c1f0f7f464562johanengelen var loader = new testY.Loader({
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen combine: true,
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen ignoreRegistered: true,
035e109c2dce9f6a9552f75d09b1573311d02546tweenk require: ['node', 'dd', 'console']
035e109c2dce9f6a9552f75d09b1573311d02546tweenk });
035e109c2dce9f6a9552f75d09b1573311d02546tweenk var out = loader.resolve(true);
035e109c2dce9f6a9552f75d09b1573311d02546tweenk Assert.isTrue((out.js.length === 1), 'NO JS files returned');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue((out.css.length === 1), 'NO CSS files returned');
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test_resolve_filter_debug: function() {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var loader = new testY.Loader({
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm filter: 'debug',
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm combine: true,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm ignoreRegistered: true,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm require: ['node', 'dd', 'console']
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm });
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var out = loader.resolve(true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue((out.js.length === 1), 'NO JS files returned');
738092bcf0d040b2431137e191dfd7cf3ce3afadJohan Engelen Assert.isTrue((out.css.length === 1), 'NO CSS files returned');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue((out.js[0].indexOf('-debug') > 0), 'Debug filter did not work');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm },
738092bcf0d040b2431137e191dfd7cf3ce3afadJohan Engelen test_resolve_filter_min: function() {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var loader = new testY.Loader({
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm filter: 'min',
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm combine: true,
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak ignoreRegistered: true,
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak require: ['node', 'dd', 'console']
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak });
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak var out = loader.resolve(true);
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak Assert.isTrue((out.js.length === 1), 'NO JS files returned');
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak Assert.isTrue((out.css.length === 1), 'NO CSS files returned');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue((out.js[0].indexOf('-min') > 0), 'Min filter did not work');
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test_resolve_filter_raw: function() {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith var loader = new testY.Loader({
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith filter: 'raw',
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith combine: true,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm ignoreRegistered: true,
963f23115db07f460bdd862b957f8bd9dba88b9bgustav_b require: ['node', 'dd', 'console']
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen });
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould var out = loader.resolve(true);
d67024fee7c560721468212767fb6aa221d5b542John Smith Assert.isTrue((out.js.length === 1), 'NO JS files returned');
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak Assert.isTrue((out.css.length === 1), 'NO CSS files returned');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue((out.js[0].indexOf('-min') === -1), 'Raw filter did not work');
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith Assert.isTrue((out.js[0].indexOf('-debug') === -1), 'Raw filter did not work');
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith },
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith test_resolve_combo_sep: function() {
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith var loader = new testY.Loader({
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith comboSep: '==!!==',
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith combine: true,
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen ignoreRegistered: true,
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen require: ['node', 'dd', 'console']
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm });
963f23115db07f460bdd862b957f8bd9dba88b9bgustav_b var out = loader.resolve(true);
963f23115db07f460bdd862b957f8bd9dba88b9bgustav_b Assert.isTrue((out.js.length === 1), 'NO JS files returned');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue((out.css.length === 1), 'NO CSS files returned');
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen Assert.isTrue((out.js[0].indexOf('&') === -1), 'comboSep did not work');
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen Assert.isTrue((out.js[0].indexOf('==!!==') > 0), 'comboSep did not work');
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen },
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith test_resolve_filters: function() {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith var loader = new testY.Loader({
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen filters: { 'node-base': 'debug' },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm combine: true,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm ignoreRegistered: true,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm require: ['node', 'dd', 'console']
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen });
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith var out = loader.resolve(true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue((out.js.length === 1), 'NO JS files returned');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue((out.css.length === 1), 'NO CSS files returned');
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith Assert.isTrue((out.js[0].indexOf('node-base-debug.js') > 0), 'node-base-debug was not found');
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith Assert.isTrue((out.js[0].indexOf('node-core-debug.js') === -1), 'node-core-debug was found');
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith },
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith test_group_filters: function() {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith var test = this;
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith YUI({
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith debug: true,
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith filter: 'DEBUG',
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith groups: {
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith local: {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith filter: 'raw',
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith combine: false,
c67c19fc5d1f6d97cc795b5a53998434b431c641John Smith base: './assets/',
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith modules: {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith foo: {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith requires: [ 'node', 'widget' ]
8e7d13ca30e4b9671afc47f03dc11affd5507077Alex Valavanis }
8e7d13ca30e4b9671afc47f03dc11affd5507077Alex Valavanis }
8e7d13ca30e4b9671afc47f03dc11affd5507077Alex Valavanis }
8e7d13ca30e4b9671afc47f03dc11affd5507077Alex Valavanis }
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith }).use('foo', function(Y) {
8e7d13ca30e4b9671afc47f03dc11affd5507077Alex Valavanis test.resume(function() {
8e7d13ca30e4b9671afc47f03dc11affd5507077Alex Valavanis Assert.isTrue(Y.Foo, 'Raw groups module did not load');
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith });
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith });
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith test.wait();
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith },
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen /* Commenting out until bug #2531436 get's completed.
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen test_module_attrs: function() {
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen var test = this;
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen
e018daf5696bee513e8574a6730e2ce79d2a3a23johanengelen YUI({
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen modules: {
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen 'attrs-js': {
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen fullpath: './assets/attrs.js',
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen jsAttributes: {
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen id: 'attrs-js-test'
b3722066cc416b6582d9a9a3ffc8ba2e868e102cjohanengelen }
035e109c2dce9f6a9552f75d09b1573311d02546tweenk },
11d3fae21261f21488c39b12b716385b5a91c847Johan Engelen 'attrs-css': {
b3722066cc416b6582d9a9a3ffc8ba2e868e102cjohanengelen fullpath: './assets/attrs.css',
607ec3f31779845d307f157ff34472da27b8bdbcjohanengelen type: 'css',
b3722066cc416b6582d9a9a3ffc8ba2e868e102cjohanengelen cssAttributes: {
b3722066cc416b6582d9a9a3ffc8ba2e868e102cjohanengelen id: 'attrs-css-test'
b3722066cc416b6582d9a9a3ffc8ba2e868e102cjohanengelen }
b3722066cc416b6582d9a9a3ffc8ba2e868e102cjohanengelen }
b3722066cc416b6582d9a9a3ffc8ba2e868e102cjohanengelen }
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen }).use('attrs-js', 'attrs-css', 'node', function(Y) {
b3722066cc416b6582d9a9a3ffc8ba2e868e102cjohanengelen test.resume(function() {
b3722066cc416b6582d9a9a3ffc8ba2e868e102cjohanengelen Assert.isTrue(Y.davglass, 'Attrs JS did not load');
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen Assert.isNotNull(Y.one('#attrs-js-test'), 'attrs-js-test id was not found');
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith Assert.isNotNull(Y.one('#attrs-css-test'), 'attrs-css-test id was not found');
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith });
b4998608f5fbde14c744b6ab8020664300e11f80jucablues });
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith test.wait();
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm */
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith test_iter: function() {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var test = this;
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen YUI({
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen filter: 'debug',
d67024fee7c560721468212767fb6aa221d5b542John Smith gallery: 'gallery-2010.08.04-19-46',
d67024fee7c560721468212767fb6aa221d5b542John Smith '2in3': '4',
d67024fee7c560721468212767fb6aa221d5b542John Smith 'yui2': '2.9.0'
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }).use('node', 'base', 'gallery-port', 'yui2-yahoo', function(Y) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.areEqual(Y.config.yui2, Y.YUI2.VERSION, 'Failed to load ' + Y.config.yui2);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isFunction(Y.Base, 'Y.Base did not load');
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen Assert.isUndefined(Y.LOADED, 'Callback executed twice.');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Y.LOADED = true;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm });
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
c0cd5511d3b975ebe07d019c1f5528108725e438johanengelen YUI({
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm filter: 'debug',
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm gallery: 'gallery-2010.08.04-19-46',
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm '2in3': '4',
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm 'yui2': '2.9.0'
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }).use('gallery-treeview', 'yui2-dom', function(Y) {
a95be1234ba4df33d6d074589edaa56f0d546069buliabyak test.resume(function() {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.areEqual(Y.config.yui2, Y.YUI2.VERSION, 'Failed to load ' + Y.config.yui2);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isObject(Y.YUI2.util.Dom, 'YUI2 DOM did not load.');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isFunction(Y.apm.TreeView, 'Treeview gallery module did not load.');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isUndefined(Y.LOADED, 'Callback executed twice.');
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gould Y.LOADED = true;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm });
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen });
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen test.wait();
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen },
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen test_progress: function() {
fdad0bc3aa765bdc61fe39e8c4da03f717525dccjohanengelen var test = this,
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith proContext,
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith counter = 0;
5cf332777b4c27336d64c273ac63bce3ee27a53dAlex Valavanis
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen YUI({
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen '2in3': '4',
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm 'yui2': '2.9.0',
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen onProgress: function(e) {
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen proContext = this;
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith if (e.name.indexOf('-ie') === -1) { //Weed out IE only modules
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith counter++;
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen }
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }).use('gallery-bitly', 'yui2-editor', function(Y) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test.resume(function() {
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak Assert.areEqual(Y.config.yui2, Y.YUI2.VERSION, 'Failed to load ' + Y.config.yui2);
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak Assert.isTrue((counter > 2), 'Did not load enough files..');
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak Assert.areSame(proContext, Y, 'onProgress context does not match');
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak Assert.isUndefined(Y.LOADED, 'Callback executed twice.');
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak Assert.isObject(Y.YUI2.util.Dom, 'YUI2 DOM did not load.');
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gould Assert.isFunction(Y.YUI2.widget.Editor, 'YUI2 Editor did not load.');
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak Assert.isFunction(Y.bitly, 'gallery-bitly did not load.');
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak Y.LOADED = true;
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak });
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak });
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test.wait();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test_condpattern: function() {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var test = this;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
c0cd5511d3b975ebe07d019c1f5528108725e438johanengelen YUI({
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm groups: {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm testpatterns: {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm patterns: {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith modtest: {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith test: function(mname) {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith return (mname === 'mod')
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm configFn: function(me) {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm me.fullpath = './assets/mod.js';
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith }).use('mod', function(Y) {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith test.resume(function() {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.isTrue(Y.MOD, 'Pattern module failed to load');
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen });
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen });
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test.wait();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm },
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen test_cond_with_test_function: function() {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var test = this;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm YUI({
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak modules: {
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak cond2: {
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak fullpath: './assets/cond2.js',
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak condition: {
c730b7fa118ad88d7cc6047dcc78e7098cdf79caKrzysztof Kosiński trigger: 'jsonp',
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak test: function() {
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen return true;
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen }
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }).use('jsonp', function(Y) {
23d859f2ce09c04ed802cb4912cc9c50f512f0a2bgk test.resume(function() {
23d859f2ce09c04ed802cb4912cc9c50f512f0a2bgk Assert.isTrue(Y.COND2, 'Conditional module failed to load with test function');
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen });
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen });
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen test.wait();
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test_cond_no_test_or_ua: function() {
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen var test = this;
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen YUI({
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gould modules: {
c730b7fa118ad88d7cc6047dcc78e7098cdf79caKrzysztof Kosiński cond: {
f0ed14f45951d21de3ff2c7c131f6aafa6e30c17buliabyak fullpath: './assets/cond.js',
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm condition: {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm trigger: 'yql'
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith }
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm }).use('yql', function(Y) {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith test.resume(function() {
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith Assert.isTrue(Y.COND, 'Conditional module failed to load with no test function or UA defined');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm });
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen });
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen test.wait();
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen },
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen test_css_stamp: function() {
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen var test = this,
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen links = document.getElementsByTagName('link').length;
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen YUI().use('cssgrids', 'dial', function(Y) {
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen test.resume(function() {
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen var links2 = document.getElementsByTagName('link').length;
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen Assert.areEqual(links, links2, 'A new link tag was injected into the page.');
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen });
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen });
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen
edcba9f1706559e93aa06a7173daa6cd6516acb5Johan B. C. Engelen test.wait();
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith },
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm test_forcemap: function() {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var test = this;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm var loader = new Y.Loader({
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm ignoreRegistered: true,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm force : ['yui-base'],
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm require : ['json']
0d00bc9f32167e81375a4be524572b27e2894ee4John Smith });
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm loader.calculate();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Assert.areEqual(loader.sorted[0], 'yui-base', 'Forced yui-base was not included in loader.sorted');
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen }
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen });
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen var suite = new Y.Test.Suite("Loader Automated Tests");
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen suite.add(testLoader);
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen Y.Test.Runner.add(suite);
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen
852b4f6c7a572bc2ccbd96e80c4063a38f77153bjohanengelen});
0563fd55cbad59e8a878e6d4cbbdd8e47f74488djohanengelen