diff options
Diffstat (limited to 'spec/env/runtime.js')
-rw-r--r-- | spec/env/runtime.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/env/runtime.js b/spec/env/runtime.js index 68e40b0..e73d111 100644 --- a/spec/env/runtime.js +++ b/spec/env/runtime.js @@ -8,11 +8,21 @@ var _ = require('underscore'), global.Handlebars = undefined; vm.runInThisContext(fs.readFileSync(__dirname + '/../../dist/handlebars.runtime.js'), 'dist/handlebars.runtime.js'); +var parse = require('../../dist/cjs/handlebars/compiler/base').parse; var compiler = require('../../dist/cjs/handlebars/compiler/compiler'); +var JavaScriptCompiler = require('../../dist/cjs/handlebars/compiler/javascript-compiler')['default']; global.CompilerContext = { compile: function(template, options) { - var templateSpec = compiler.precompile(template, options); + // Hack the compiler on to the environment for these specific tests + handlebarsEnv.precompile = function(template, options) { + return compiler.precompile(template, options, handlebarsEnv); + }; + handlebarsEnv.parse = parse; + handlebarsEnv.Compiler = compiler.Compiler; + handlebarsEnv.JavaScriptCompiler = JavaScriptCompiler; + + var templateSpec = handlebarsEnv.precompile(template, options); return handlebarsEnv.template(safeEval(templateSpec)); }, compileWithPartial: function(template, options) { @@ -20,6 +30,10 @@ global.CompilerContext = { handlebarsEnv.compile = function(template, options) { return compiler.compile(template, options, handlebarsEnv); }; + handlebarsEnv.parse = parse; + handlebarsEnv.Compiler = compiler.Compiler; + handlebarsEnv.JavaScriptCompiler = JavaScriptCompiler; + return handlebarsEnv.compile(template, options); } }; |