Update test files to work with underscore builds defined as named amd modules.

This commit is contained in:
John-David Dalton
2014-02-15 01:17:00 -08:00
parent 7edf024c71
commit 8a25592904
2 changed files with 10 additions and 7 deletions

View File

@@ -186,7 +186,7 @@
var reBasename = /[\w.-]+$/, var reBasename = /[\w.-]+$/,
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''), basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
modulePath = ui.buildPath.replace(/\.js$/, ''), modulePath = ui.buildPath.replace(/\.js$/, ''),
locationPath = modulePath.replace(reBasename, '').replace(/\/$/, ''), locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
moduleMain = modulePath.match(reBasename)[0], moduleMain = modulePath.match(reBasename)[0],
uid = +new Date; uid = +new Date;

View File

@@ -143,18 +143,21 @@
return; return;
} }
var reBasename = /[\w.-]+$/, var reBasename = /[\w.-]+$/,
basePath = ('//' + location.host + location.pathname).replace(/\btest\/$/, ''), basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
modulePath = ui.buildPath.replace(/\.js$/, ''), modulePath = ui.buildPath.replace(/\.js$/, ''),
locationPath = modulePath.replace(reBasename, '').replace(/\/$/, ''), locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
moduleMain = modulePath.match(reBasename)[0]; moduleId = /\bunderscore\b/.test(ui.buildPath) ? 'underscore' : 'lodash',
moduleMain = modulePath.match(reBasename)[0],
uid = +new Date;
function getConfig() { function getConfig() {
return { return {
'baseUrl': './', 'baseUrl': './',
'urlArgs': 't=' + (+new Date), 'urlArgs': 't=' + uid++,
'waitSeconds': 0,
'packages': [ 'packages': [
{ {
'name': 'lodash', 'name': moduleId,
'location': locationPath, 'location': locationPath,
'main': moduleMain 'main': moduleMain
}, },
@@ -174,7 +177,7 @@
QUnit.config.autostart = false; QUnit.config.autostart = false;
// load Lo-Dash as a module // load Lo-Dash as a module
require(getConfig(), ['lodash'], function(lodash) { require(getConfig(), [moduleId], function(lodash) {
if (ui.isModularize) { if (ui.isModularize) {
window._ = lodash; window._ = lodash;
} }