Consistent use of getConfig in test/index.html and test/underscore.html.

This commit is contained in:
John-David Dalton
2014-01-25 19:52:49 -08:00
parent 129e56e570
commit 1e7927fbff
2 changed files with 30 additions and 26 deletions

View File

@@ -196,8 +196,6 @@
moduleMain = modulePath.match(reBasename)[0], moduleMain = modulePath.match(reBasename)[0],
uid = +new Date; uid = +new Date;
QUnit.config.autostart = false;
function getConfig() { function getConfig() {
return { return {
'baseUrl': './', 'baseUrl': './',
@@ -239,7 +237,7 @@
} }
function loadTests() { function loadTests() {
require(['test'], function() { require(getConfig(), ['test'], function() {
QUnit.start(); QUnit.start();
}); });
} }
@@ -264,7 +262,7 @@
window._ = lodash; window._ = lodash;
} }
if (ui.isModularize) { if (ui.isModularize) {
require(['lodash/internals/baseEach'], function(baseEach) { require(getConfig(), ['lodash/internals/baseEach'], function(baseEach) {
lodash._baseEach = baseEach; lodash._baseEach = baseEach;
loadTests(); loadTests();
}); });
@@ -273,6 +271,9 @@
} }
}); });
} }
QUnit.config.autostart = false;
if (window.requirejs) { if (window.requirejs) {
addBizarroMethods(); addBizarroMethods();
require(getConfig(), ['lodash'], function(lodash) { require(getConfig(), ['lodash'], function(lodash) {

View File

@@ -155,34 +155,37 @@
locationPath = modulePath.replace(reBasename, '').replace(/\/$/, ''), locationPath = modulePath.replace(reBasename, '').replace(/\/$/, ''),
moduleMain = modulePath.match(reBasename)[0]; moduleMain = modulePath.match(reBasename)[0];
function getConfig() {
return {
'baseUrl': './',
'urlArgs': 't=' + (+new Date),
'packages': [
{
'name': 'lodash',
'location': locationPath,
'main': moduleMain
},
{
'name': 'test',
'location': '../vendor/underscore/test',
'config': {
// work around no global being exported
'exports': 'QUnit',
'loader': 'curl/loader/legacy'
}
}
]
};
}
QUnit.config.autostart = false; QUnit.config.autostart = false;
// load Lo-Dash as a module // load Lo-Dash as a module
require({ require(getConfig(), ['lodash'], function(lodash) {
'baseUrl': './',
'urlArgs': 't=' + (+new Date),
'packages': [
{
'name': 'lodash',
'location': locationPath,
'main': moduleMain
},
{
'name': 'test',
'location': '../vendor/underscore/test',
'config': {
// work around no global being exported
'exports': 'QUnit',
'loader': 'curl/loader/legacy'
}
}
]
},
['lodash'], function(lodash) {
if (ui.isModularize) { if (ui.isModularize) {
window._ = lodash; window._ = lodash;
} }
require([ require(getConfig(), [
'test/collections', 'test/collections',
'test/arrays', 'test/arrays',
'test/functions', 'test/functions',