core-tests.js revision bc1109485d3d133cb6432ab3116e13496ef0bf47
/* {{{ Core URL Tests */
var core_urls = {
'http://localhost/build/yui-base/yui-base.js': { path: 'http://localhost/build/', filter: undefined },
'http://localhost/build/yui-base/yui-base-debug.js': { path: 'http://localhost/build/', filter: 'debug' },
'http://combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base.js': { path: 'http://combohost.com/combo?/build/', filter: undefined },
'http://combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base-debug.js': { path: 'http://combohost.com/combo?/build/', filter: 'debug' },
'http://combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base.js&build/loader/loader.js': { path: 'http://combohost.com/combo?/build/', filter: undefined },
'http://combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base-debug.js&buid/loader/loader.js': { path: 'http://combohost.com/combo?/build/', filter: 'debug' },
'https://localhost/build/yui-base/yui-base.js': { path: 'https://localhost/build/', filter: undefined },
'https://localhost/build/yui-base/yui-base-debug.js': { path: 'https://localhost/build/', filter: 'debug' },
'https://combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base.js': { path: 'https://combohost.com/combo?/build/', filter: undefined },
'https://combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base-debug.js': { path: 'https://combohost.com/combo?/build/', filter: 'debug' },
'https://combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base.js&build/loader/loader.js': { path: 'https://combohost.com/combo?/build/', filter: undefined },
'https://combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base-debug.js&buid/loader/loader.js': { path: 'https://combohost.com/combo?/build/', filter: 'debug' },
'//combohost.com/combo?foo/foo.js&bar-bar.js&/build/simpleyui/simpleyui.js&build/loader/loader.js': { path: '//combohost.com/combo?/build/', filter: undefined },
'//combohost.com/combo?foo/foo.js&bar-bar.js&/build/simpleyui/simpleyui-debug.js&buid/oop/oop.js': { path: '//combohost.com/combo?/build/', filter: 'debug' },
'//combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base.js': { path: '//combohost.com/combo?/build/', filter: undefined },
'//combohost.com/combo?foo/foo.js&bar-bar.js&/build/yui-base/yui-base-debug.js': { path: '//combohost.com/combo?/build/', filter: 'debug' }
};
/* }}} */
name: "Core tests",
'cached functions should execute only once per input': function() {
var f1 = function(a) {
r1 += a;
};
c1('a');
c1('b');
c1('a');
c1('b');
c1('a');
c1('b');
var f2 = function(a, b) {
r2 += (a + b);
};
var o = new Y.EventTarget();
o.foo = 1;
var f3 = function(a) {
r3 += a;
};
a: 'z'
});
c3('a');
c3('b');
c3('a');
c3('b');
c3('a');
c3('b');
// falsy second arg needs to produce a different key than no second arg
},
test_cached_undefined_null: function() {
var f1 = function(a) {
return a;
};
var a = c1(null);
a = c1('foo');
},
test_ie_enum_bug: function() {
var o = {
valueOf: function() {
return 'foo';
}
},
p = Y.merge(o);
},
test_guid: function() {
for (i = 0; i < 1000; i++) {
}
},
test_stamp: function() {
for (i = 0; i < 1000; i++) {
}
},
test_use_array: function() {
});
},
test_use_strings: function() {
});
},
test_one_submodule: function() {
YUI({
modules:{
'something':{
'submodules':{
'something1':{
}
}
}
}
}).use('something1', function(Y) {
});
},
test_rollup_false: function() {
});
});
},
test_base_path: function() {
for (var i in core_urls) {
//This test is assuming that IE returns an undefined, but it actually returns an empty string for the property
//Assert.areSame(info.filter, core_urls[i].filter, 'Filters do not match (' + core_urls[i].path + ')');
}
},
test_log_params: function() {
return;
}
last;
};
Y.config.logInclude = {
logMe: true,
butNotMe: false
};
Y.config.logExclude = {
excludeMe: true,
butDontExcludeMe: false
};
});
},
test_loader_combo_sep: function() {
debug: true,
combine: true,
comboSep: '--;;--'
});
var url = s[0];
Assert.isTrue((url.indexOf(testY.config.comboSep) > 5), 'Combo seperator (' + testY.config.comboSep + ') was not used');
};
},
test_multiple_ua: function() {
uaFF = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0) Gecko/20100101 Firefox/6.0',
uaChrome = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.860.0 Safari/535.2';
Assert.areEqual(YUI.Env.UA.userAgent, Y2.UA.userAgent, 'Global UA and local (Y2) UA are different');
}
});
});