summaryrefslogtreecommitdiffstats
path: root/spec/helpers.js
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2013-07-26 17:18:56 +0000
committerYehuda Katz <wycats@gmail.com>2013-07-26 17:18:56 +0000
commitd33408fcbdc5b23615ebc51b0b25a3d69818de4c (patch)
treea9cc4f0fcaa88df811ea9c11a7bda13fe8cc46c9 /spec/helpers.js
parent5f664dd78b2c558a8a560b3fd0074109d52daf62 (diff)
downloadhandlebars.js-d33408fcbdc5b23615ebc51b0b25a3d69818de4c.zip
handlebars.js-d33408fcbdc5b23615ebc51b0b25a3d69818de4c.tar.gz
handlebars.js-d33408fcbdc5b23615ebc51b0b25a3d69818de4c.tar.bz2
Move more testing mutations into the environment
Diffstat (limited to 'spec/helpers.js')
-rw-r--r--spec/helpers.js31
1 files changed, 13 insertions, 18 deletions
diff --git a/spec/helpers.js b/spec/helpers.js
index 71f09d3..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,26 +173,21 @@ describe('helpers', function() {
});
it("Multiple global helper registration", function() {
- var helpers = Handlebars.helpers;
- try {
- Handlebars.helpers = {};
+ var helpers = handlebarsEnv.helpers;
+ handlebarsEnv.helpers = {};
- Handlebars.registerHelper({
- 'if': helpers['if'],
- world: function() { return "world!"; },
- test_helper: function() { return 'found it!'; }
- });
+ 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!!");
- } finally {
- if (helpers) {
- Handlebars.helpers = helpers;
- }
- }
+ 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 = {};