diff options
Diffstat (limited to 'spec/javascript-compiler.js')
-rw-r--r-- | spec/javascript-compiler.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/javascript-compiler.js b/spec/javascript-compiler.js index ded4f3e..884abf1 100644 --- a/spec/javascript-compiler.js +++ b/spec/javascript-compiler.js @@ -20,6 +20,28 @@ describe('javascript-compiler api', function() { shouldCompileTo("{{foo}}", { bar_foo: "food" }, "food"); }); }); + describe('#compilerInfo', function() { + var $superCheck, $superInfo; + beforeEach(function() { + $superCheck = handlebarsEnv.VM.checkRevision; + $superInfo = handlebarsEnv.JavaScriptCompiler.prototype.compilerInfo; + }); + afterEach(function() { + handlebarsEnv.VM.checkRevision = $superCheck; + handlebarsEnv.JavaScriptCompiler.prototype.compilerInfo = $superInfo; + }); + it('should allow compilerInfo override', function() { + handlebarsEnv.JavaScriptCompiler.prototype.compilerInfo = function() { + return 'this.compilerInfo = "crazy";'; + }; + handlebarsEnv.VM.checkRevision = function(compilerInfo) { + if (compilerInfo !== 'crazy') { + throw new Error('It didn\'t work'); + } + }; + shouldCompileTo("{{foo}} ", { foo: "food" }, "food "); + }); + }); describe('buffer', function() { var $superAppend, $superCreate; beforeEach(function() { |