mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Add another unit test for precompiled templates with AMD support.
Former-commit-id: 68d1b7b0aa8cd8b1d4b27a9374095b8cebbfb386
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<% _.forEach(people, function(name) { %><li><%= name %></li><% }); %>
|
<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -535,6 +535,8 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
commands.forEach(function(command) {
|
commands.forEach(function(command) {
|
||||||
|
var expectedId = /underscore/.test(command) ? 'underscore' : 'lodash';
|
||||||
|
|
||||||
asyncTest('`lodash template=*.jst` exports=amd' + (command ? ' ' + command : ''), function() {
|
asyncTest('`lodash template=*.jst` exports=amd' + (command ? ' ' + command : ''), function() {
|
||||||
var start = _.after(2, _.once(QUnit.start));
|
var start = _.after(2, _.once(QUnit.start));
|
||||||
|
|
||||||
@@ -551,8 +553,10 @@
|
|||||||
context.define.amd = {};
|
context.define.amd = {};
|
||||||
vm.runInContext(data.source, context);
|
vm.runInContext(data.source, context);
|
||||||
|
|
||||||
equal(moduleId, (command ? 'underscore' : 'lodash'), basename);
|
equal(moduleId, expectedId, basename);
|
||||||
ok('a' in _.templates && 'b' in _.templates, basename);
|
ok('a' in _.templates && 'b' in _.templates, basename);
|
||||||
|
equal(_.templates.a({ 'people': ['moe', 'larry'] }), '<ul>\n<li>moe</li><li>larry</li>\n</ul>', basename);
|
||||||
|
|
||||||
delete _.templates;
|
delete _.templates;
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
@@ -578,7 +582,7 @@
|
|||||||
context.define.amd = {};
|
context.define.amd = {};
|
||||||
vm.runInContext(data.source, context);
|
vm.runInContext(data.source, context);
|
||||||
|
|
||||||
equal(moduleId, (command ? 'underscore' : 'lodash'), basename);
|
equal(moduleId, expectedId, basename);
|
||||||
equal(_.templates.d(object.d), 'Hello Mustache!', basename);
|
equal(_.templates.d(object.d), 'Hello Mustache!', basename);
|
||||||
delete _.templates;
|
delete _.templates;
|
||||||
start();
|
start();
|
||||||
|
|||||||
Reference in New Issue
Block a user