summaryrefslogtreecommitdiffstats
path: root/spec/helpers.js
diff options
context:
space:
mode:
authorKevin Decker <kpdecker@gmail.com>2013-10-12 14:22:10 -0700
committerKevin Decker <kpdecker@gmail.com>2013-10-12 14:22:10 -0700
commit583141de7cb61eb70eaa6b33c25f475f3048071b (patch)
tree47c419f82f2941fbde5ff5aa33a85b79d6772b4c /spec/helpers.js
parent782aae95d0b430058e2f65b8eba1621453f9055e (diff)
parent3f96319f103d1e9dc4a6de220d2a9934e00df0b6 (diff)
downloadhandlebars.js-583141de7cb61eb70eaa6b33c25f475f3048071b.zip
handlebars.js-583141de7cb61eb70eaa6b33c25f475f3048071b.tar.gz
handlebars.js-583141de7cb61eb70eaa6b33c25f475f3048071b.tar.bz2
Merge pull request #628 from wycats/es6-modules
Convert code to ES6 modules
Diffstat (limited to 'spec/helpers.js')
-rw-r--r--spec/helpers.js32
1 files changed, 14 insertions, 18 deletions
diff --git a/spec/helpers.js b/spec/helpers.js
index 9fb32e6..c5ea574 100644
--- a/spec/helpers.js
+++ b/spec/helpers.js
@@ -161,7 +161,7 @@ describe('helpers', function() {
});
it("the helper hash should augment the global hash", function() {
- Handlebars.registerHelper('test_helper', function() { return 'found it!'; });
+ handlebarsEnv.registerHelper('test_helper', function() { return 'found it!'; });
shouldCompileTo(
"{{test_helper}} {{#if cruel}}Goodbye {{cruel}} {{world}}!{{/if}}", [
@@ -173,25 +173,21 @@ describe('helpers', function() {
});
it("Multiple global helper registration", function() {
- var helpers = Handlebars.helpers;
- try {
- Handlebars.helpers = {};
- Handlebars.registerHelper({
- 'if': helpers['if'],
- world: function() { return "world!"; },
- test_helper: function() { return 'found it!'; }
- });
+ var helpers = handlebarsEnv.helpers;
+ handlebarsEnv.helpers = {};
- shouldCompileTo(
- "{{test_helper}} {{#if cruel}}Goodbye {{cruel}} {{world}}!{{/if}}",
- [{cruel: "cruel"}],
- "found it! Goodbye cruel world!!");
- } finally {
- if (helpers) {
- Handlebars.helpers = helpers;
- }
- }
+ handlebarsEnv.registerHelper({
+ 'if': helpers['if'],
+ world: function() { return "world!"; },
+ test_helper: function() { return 'found it!'; }
+ });
+
+ shouldCompileTo(
+ "{{test_helper}} {{#if cruel}}Goodbye {{cruel}} {{world}}!{{/if}}",
+ [{cruel: "cruel"}],
+ "found it! Goodbye cruel world!!");
});
+
it("negative number literals work", function() {
var string = 'Message: {{hello -12}}';
var hash = {};