Add another unit test for precompiled templates with AMD support.

Former-commit-id: 68d1b7b0aa8cd8b1d4b27a9374095b8cebbfb386
This commit is contained in:
John-David Dalton
2013-02-13 19:56:00 -08:00
parent 1090228628
commit 7e4286adde
2 changed files with 7 additions and 3 deletions

View File

@@ -1,3 +1,3 @@
<ul>
<% _.forEach(people, function(name) { %><li><%= name %></li><% }); %>
<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>
</ul>

View File

@@ -535,6 +535,8 @@
];
commands.forEach(function(command) {
var expectedId = /underscore/.test(command) ? 'underscore' : 'lodash';
asyncTest('`lodash template=*.jst` exports=amd' + (command ? ' ' + command : ''), function() {
var start = _.after(2, _.once(QUnit.start));
@@ -551,8 +553,10 @@
context.define.amd = {};
vm.runInContext(data.source, context);
equal(moduleId, (command ? 'underscore' : 'lodash'), basename);
equal(moduleId, expectedId, 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;
start();
});
@@ -578,7 +582,7 @@
context.define.amd = {};
vm.runInContext(data.source, context);
equal(moduleId, (command ? 'underscore' : 'lodash'), basename);
equal(moduleId, expectedId, basename);
equal(_.templates.d(object.d), 'Hello Mustache!', basename);
delete _.templates;
start();