summaryrefslogtreecommitdiffstats
path: root/spec/env/node.js
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2013-07-26 16:50:37 +0000
committerYehuda Katz <wycats@gmail.com>2013-07-26 16:50:37 +0000
commit5f664dd78b2c558a8a560b3fd0074109d52daf62 (patch)
tree16a72bc0c85699e95bed94c927a8ab2586617ece /spec/env/node.js
parentf5c8484ea0c1ac1aec6994ad3b5928fb67b7aa62 (diff)
downloadhandlebars.js-5f664dd78b2c558a8a560b3fd0074109d52daf62.zip
handlebars.js-5f664dd78b2c558a8a560b3fd0074109d52daf62.tar.gz
handlebars.js-5f664dd78b2c558a8a560b3fd0074109d52daf62.tar.bz2
Make the Handlebars environment into an object
The idea is that the environment wraps up the mutable stuff in Handlebars (like the helpers) and that you could theoretically create a new one at any time and pass it in to Handlebars.template. Every test makes a new environment and uses it in template compilation.
Diffstat (limited to 'spec/env/node.js')
-rw-r--r--spec/env/node.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/env/node.js b/spec/env/node.js
index e5349a1..3517479 100644
--- a/spec/env/node.js
+++ b/spec/env/node.js
@@ -3,12 +3,14 @@ require('./common');
global.Handlebars = require('../../zomg/lib/handlebars');
global.CompilerContext = {
- compile: function(template, options) {
+ compile: function(template, options, env) {
+ env = env || handlebarsEnv;
var templateSpec = Handlebars.precompile(template, options);
- console.log(templateSpec);
- return Handlebars.template(eval('(' + templateSpec + ')'));
+ return Handlebars.template(eval('(' + templateSpec + ')'), env);
},
compileWithPartial: function(template, options) {
+ options = options || {};
+ options.env = handlebarsEnv;
return Handlebars.compile(template, options);
}
};