diff options
author | kpdecker <kpdecker@gmail.com> | 2014-08-23 17:44:45 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-08-23 17:44:45 -0500 |
commit | cde008b49f3cc64711a23c107fa53ad612954aef (patch) | |
tree | 0980f61500f3a54a0a27cde09cd092a09e936788 /spec/precompiler.js | |
parent | 84d646bb5d5a8bb01bfb9465ee1078161f069742 (diff) | |
download | handlebars.js-cde008b49f3cc64711a23c107fa53ad612954aef.zip handlebars.js-cde008b49f3cc64711a23c107fa53ad612954aef.tar.gz handlebars.js-cde008b49f3cc64711a23c107fa53ad612954aef.tar.bz2 |
Cleanup from code coverage report
Diffstat (limited to 'spec/precompiler.js')
-rw-r--r-- | spec/precompiler.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/precompiler.js b/spec/precompiler.js index 57fc280..3b66353 100644 --- a/spec/precompiler.js +++ b/spec/precompiler.js @@ -75,9 +75,39 @@ describe('precompiler', function() { Precompiler.cli({templates: [__dirname + '/artifacts/empty.handlebars'], amd: true, extension: 'handlebars'}); equal(/template\(amd\)/.test(log), true); }); + it('should output multiple amd', function() { + Handlebars.precompile = function() { return 'amd'; }; + Precompiler.cli({templates: [__dirname + '/artifacts'], amd: true, extension: 'handlebars'}); + equal(/return templates/.test(log), true); + equal(/template\(amd\)/.test(log), true); + }); + it('should output amd partials', function() { + Handlebars.precompile = function() { return 'amd'; }; + Precompiler.cli({templates: [__dirname + '/artifacts/empty.handlebars'], amd: true, partial: true, extension: 'handlebars'}); + equal(/return Handlebars\.partials\['empty'\]/.test(log), true); + equal(/template\(amd\)/.test(log), true); + }); + it('should output multiple amd partials', function() { + Handlebars.precompile = function() { return 'amd'; }; + Precompiler.cli({templates: [__dirname + '/artifacts'], amd: true, partial: true, extension: 'handlebars'}); + equal(/return Handlebars\.partials\[/.test(log), false); + equal(/template\(amd\)/.test(log), true); + }); it('should output commonjs templates', function() { Handlebars.precompile = function() { return 'commonjs'; }; Precompiler.cli({templates: [__dirname + '/artifacts/empty.handlebars'], commonjs: true, extension: 'handlebars'}); equal(/template\(commonjs\)/.test(log), true); }); + + it('should set data flag', function() { + Handlebars.precompile = function(data, options) { equal(options.data, true); return 'simple'; }; + Precompiler.cli({templates: [__dirname + '/artifacts/empty.handlebars'], simple: true, extension: 'handlebars', data: true}); + equal(log, 'simple\n'); + }); + + it('should set known helpers', function() { + Handlebars.precompile = function(data, options) { equal(options.knownHelpers.foo, true); return 'simple'; }; + Precompiler.cli({templates: [__dirname + '/artifacts/empty.handlebars'], simple: true, extension: 'handlebars', known: 'foo'}); + equal(log, 'simple\n'); + }); }); |