Add varname to _.templateSettings.

* Leave out the with statement when using varname.
* Rename source to compiled.
* Comments, comments, comments.
This commit is contained in:
Brad Dunbar
2012-04-03 10:57:39 -07:00
parent 8cfb076c9b
commit b04b813f02
3 changed files with 60 additions and 25 deletions

View File

@@ -1,9 +1,13 @@
$(document).ready(function() {
var templateSettings = _.templateSettings;
var templateSettings;
module("Utility", {
setup: function() {
templateSettings = _.clone(_.templateSettings);
},
teardown: function() {
_.templateSettings = templateSettings;
}
@@ -174,4 +178,9 @@ $(document).ready(function() {
strictEqual(_.result(null, 'x'), null);
});
test('_.templateSettings.varname', function() {
_.templateSettings.varname = 'data';
strictEqual(_.template('<%=data.x%>')({x: 'x'}), 'x');
});
});