Escape template properties for minified precompiled templates and add a lodash template="…" exports="…" build test.

Former-commit-id: 866252235232ab52cf21842554c37573de4cf402
This commit is contained in:
John-David Dalton
2012-10-11 23:51:15 -07:00
parent 58dc0b1aef
commit c8f871ff2a
4 changed files with 32 additions and 12 deletions

View File

@@ -483,6 +483,29 @@
equal(templates.a(data.a).replace(/[\r\n]+/g, ''), '<ul><li>moe</li><li>larry</li><li>curly</li></ul>', basename);
equal(templates.b(data.b), 'Hello stooge.', basename);
delete _.templates;
start();
});
});
asyncTest('`lodash template=*.jst` exports=amd', 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;
(context.define = function(requires, factory) {
factory(_);
var templates = _.templates;
pass = 'a' in templates && 'b' in templates;
})
.amd = {};
vm.runInContext(source, context);
ok(pass, basename);
delete _.templates;
start();
});
});