summaryrefslogtreecommitdiffstats
path: root/spec/qunit_spec.js
diff options
context:
space:
mode:
authortomhuda <tomhuda@strobecorp.com>2011-07-07 23:09:33 -0700
committertomhuda <tomhuda@strobecorp.com>2011-07-07 23:09:33 -0700
commit059a80661d132b43abf0a314ccaad32d9172d7f0 (patch)
tree52d5cf5d5871cdea6a5910368cf580b3c437bf6d /spec/qunit_spec.js
parent37e36bf1371f458212db7ee45a18ed163cd329fb (diff)
downloadhandlebars.js-059a80661d132b43abf0a314ccaad32d9172d7f0.zip
handlebars.js-059a80661d132b43abf0a314ccaad32d9172d7f0.tar.gz
handlebars.js-059a80661d132b43abf0a314ccaad32d9172d7f0.tar.bz2
* Remove legacy support for inverse sections as additional parameters.
* Unify inverse and normal block helpers * Make Handlebars.Exception inherit from JS Error
Diffstat (limited to 'spec/qunit_spec.js')
-rw-r--r--spec/qunit_spec.js14
1 files changed, 4 insertions, 10 deletions
diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js
index 56cb687..7b33233 100644
--- a/spec/qunit_spec.js
+++ b/spec/qunit_spec.js
@@ -179,12 +179,6 @@ test("inverted section with empty set", function() {
shouldCompileTo(string, hash, "Right On!", "Inverted section rendered when value is empty set.");
});
-test("inverted section using result of function call", function() {
- var string = "{{goodbyes}}{{^goodbyes}}Right On!{{/goodbyes}}";
- var hash = {goodbyes: function() { return false; }}
- shouldCompileTo(string, hash, "Right On!", "Inverted section rendered when result of function in expression is false.");
-});
-
module("blocks");
test("array", function() {
@@ -341,25 +335,25 @@ test("block inverted sections with empty arrays", function() {
test("block helper inverted sections", function() {
var string = "{{#list people}}{{name}}{{^}}<em>Nobody's here</em>{{/list}}"
- var list = function(context, fn, inverse) {
+ var list = function(context, options) {
if (context.length > 0) {
var out = "<ul>";
for(var i = 0,j=context.length; i < j; i++) {
out += "<li>";
- out += fn(context[i]);
+ out += options.fn(context[i]);
out += "</li>";
}
out += "</ul>";
return out;
} else {
- return "<p>" + inverse(this) + "</p>";
+ return "<p>" + options.inverse(this) + "</p>";
}
};
var hash = {list: list, people: [{name: "Alan"}, {name: "Yehuda"}]};
var empty = {list: list, people: []};
var rootMessage = {
- list: function(context, fn, inverse) { if(context.length === 0) { return "<p>" + inverse(this) + "</p>"; } },
+ list: function(context, options) { if(context.length === 0) { return "<p>" + options.inverse(this) + "</p>"; } },
people: [],
message: "Nobody's here"
}