mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
lodash: Add support for more AMD build optimizers and allow aliasing as the "underscore" module. [jddalton]
Former-commit-id: 6b3fa45d19f6a55aa7565bcb4d9221f6f159e9c9
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
||||
<script>var _2, _ = 1;</script>
|
||||
<script>var _2, _3, _ = 1;</script>
|
||||
<script src="../lodash.js"></script>
|
||||
<script src="../vendor/requirejs/require.js"></script>
|
||||
<script>
|
||||
@@ -21,16 +21,21 @@
|
||||
document.write('<script src="test.js"><\/script>');
|
||||
}
|
||||
else {
|
||||
define.amd.lodash = true;
|
||||
require({
|
||||
'baseUrl': '../vendor/requirejs/',
|
||||
'urlArgs': 't=' + (+new Date),
|
||||
'paths': {
|
||||
'lodash': '../../lodash'
|
||||
'lodash': '../../lodash',
|
||||
'underscore': './../../lodash'
|
||||
}
|
||||
},
|
||||
['lodash'], function(_) {
|
||||
_2 = _.noConflict();
|
||||
['lodash', 'underscore'], function(lodash, lodashAsUnderscore) {
|
||||
_2 = lodash.noConflict();
|
||||
_2.moduleName = 'lodash';
|
||||
|
||||
_3 = lodashAsUnderscore.noConflict();
|
||||
_3.moduleName = 'underscore';
|
||||
|
||||
require(['test.js']);
|
||||
});
|
||||
}
|
||||
|
||||
12
test/test.js
12
test/test.js
@@ -47,9 +47,17 @@
|
||||
QUnit.module('lodash');
|
||||
|
||||
(function() {
|
||||
test('supports loading lodash.js as a module', function() {
|
||||
test('supports loading lodash.js as the "lodash" module', function() {
|
||||
if (window.document && window.require) {
|
||||
equal((_2 || {}).VERSION, _.VERSION);
|
||||
equal((_2 || {}).moduleName, 'lodash');
|
||||
} else {
|
||||
skipTest(1)
|
||||
}
|
||||
});
|
||||
|
||||
test('supports loading lodash.js as the "underscore" module', function() {
|
||||
if (window.document && window.require) {
|
||||
equal((_3 || {}).moduleName, 'underscore');
|
||||
} else {
|
||||
skipTest(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user