mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Add lodash moduleId=… build option.
Former-commit-id: a68a2085028a3832181aaf02081311d84e93fab5
This commit is contained in:
@@ -488,25 +488,31 @@
|
||||
});
|
||||
});
|
||||
|
||||
asyncTest('`lodash template=*.jst` exports=amd', function() {
|
||||
var start = _.after(2, _.once(QUnit.start));
|
||||
['', 'moduleId=underscore'].forEach(function(command) {
|
||||
asyncTest('`lodash template=*.jst` exports=amd' + (command ? ' ' + command : ''), function() {
|
||||
var start = _.after(2, _.once(QUnit.start));
|
||||
|
||||
build(['-s', 'template=' + templatePath + '/*.jst', 'exports=amd'], function(source, filePath) {
|
||||
var basename = path.basename(filePath, '.js'),
|
||||
context = createContext(),
|
||||
pass = false;
|
||||
build(['-s', 'template=' + templatePath + '/*.jst', 'exports=amd'].concat(command || []), function(source, filePath) {
|
||||
var moduleId,
|
||||
basename = path.basename(filePath, '.js'),
|
||||
context = createContext(),
|
||||
pass = false;
|
||||
|
||||
(context.define = function(requires, factory) {
|
||||
factory(_);
|
||||
var templates = _.templates;
|
||||
pass = 'a' in templates && 'b' in templates;
|
||||
})
|
||||
.amd = {};
|
||||
(context.define = function(requires, factory) {
|
||||
factory(_);
|
||||
var templates = _.templates;
|
||||
moduleId = requires + '';
|
||||
pass = 'a' in templates && 'b' in templates;
|
||||
})
|
||||
.amd = {};
|
||||
|
||||
vm.runInContext(source, context);
|
||||
ok(pass, basename);
|
||||
delete _.templates;
|
||||
start();
|
||||
vm.runInContext(source, context);
|
||||
|
||||
equal(moduleId, command ? 'underscore' : 'lodash');
|
||||
ok(pass, basename);
|
||||
delete _.templates;
|
||||
start();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user