summaryrefslogtreecommitdiffstats
path: root/spec/builtins.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/builtins.js')
-rw-r--r--spec/builtins.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/builtins.js b/spec/builtins.js
index 53f46cc..bbe494e 100644
--- a/spec/builtins.js
+++ b/spec/builtins.js
@@ -203,4 +203,25 @@ describe('builtin helpers', function() {
equals("whee", logArg, "should call log with 'whee'");
});
+
+ describe('#lookup', function() {
+ it('should lookup arbitrary content', function() {
+ var string = '{{#each goodbyes}}{{lookup ../data .}}{{/each}}',
+ hash = {goodbyes: [0, 1], data: ['foo', 'bar']};
+
+ var template = CompilerContext.compile(string);
+ var result = template(hash);
+
+ equal(result, 'foobar');
+ });
+ it('should not fail on undefined value', function() {
+ var string = '{{#each goodbyes}}{{lookup ../bar .}}{{/each}}',
+ hash = {goodbyes: [0, 1], data: ['foo', 'bar']};
+
+ var template = CompilerContext.compile(string);
+ var result = template(hash);
+
+ equal(result, '');
+ });
+ });
});