summaryrefslogtreecommitdiffstats
path: root/spec/qunit_spec.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2013-01-13 22:35:03 -0600
committerkpdecker <kpdecker@gmail.com>2013-01-13 22:35:03 -0600
commit8961298859c42b3158dba7fa40b716cd2d63ef98 (patch)
tree8ea6b8d62958599aee8dcf7a335a564554668ccc /spec/qunit_spec.js
parent4f54f62abca13b5758777e3859bd34297b3c18e2 (diff)
downloadhandlebars.js-8961298859c42b3158dba7fa40b716cd2d63ef98.zip
handlebars.js-8961298859c42b3158dba7fa40b716cd2d63ef98.tar.gz
handlebars.js-8961298859c42b3158dba7fa40b716cd2d63ef98.tar.bz2
Prevent context overwrite by replaceStack
Fixes #408.
Diffstat (limited to 'spec/qunit_spec.js')
-rw-r--r--spec/qunit_spec.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js
index 1e859e5..f16949e 100644
--- a/spec/qunit_spec.js
+++ b/spec/qunit_spec.js
@@ -1282,3 +1282,15 @@ test("Passing falsy values to Handlebars.compile throws an error", function() {
CompilerContext.compile(null);
}, "You must pass a string to Handlebars.compile. You passed null");
});
+
+test('GH-408: Multiple loops fail', function() {
+ var context = [
+ { name: "John Doe", location: { city: "Chicago" } },
+ { name: "Jane Doe", location: { city: "New York"} }
+ ];
+
+ var template = CompilerContext.compile('{{#.}}{{name}}{{/.}}{{#.}}{{name}}{{/.}}');
+
+ var result = template(context);
+ equals(result, "John DoeJane DoeJohn DoeJane Doe", 'It should output twice');
+});