diff options
Diffstat (limited to 'spec/blocks.js')
-rw-r--r-- | spec/blocks.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/blocks.js b/spec/blocks.js index c57a67e..a13cce2 100644 --- a/spec/blocks.js +++ b/spec/blocks.js @@ -94,4 +94,25 @@ describe('blocks', function() { 'No people\n'); }); }); + + describe('compat mode', function() { + it("block with deep recursive lookup lookup", function() { + var string = "{{#outer}}Goodbye {{#inner}}cruel {{omg}}{{/inner}}{{/outer}}"; + var hash = {omg: "OMG!", outer: [{ inner: [{ text: "goodbye" }] }] }; + + shouldCompileTo(string, [hash, undefined, undefined, true], "Goodbye cruel OMG!"); + }); + it("block with deep recursive pathed lookup", function() { + var string = "{{#outer}}Goodbye {{#inner}}cruel {{omg.yes}}{{/inner}}{{/outer}}"; + var hash = {omg: {yes: "OMG!"}, outer: [{ inner: [{ yes: 'no', text: "goodbye" }] }] }; + + shouldCompileTo(string, [hash, undefined, undefined, true], "Goodbye cruel OMG!"); + }); + it("block with missed recursive lookup", function() { + var string = "{{#outer}}Goodbye {{#inner}}cruel {{omg.yes}}{{/inner}}{{/outer}}"; + var hash = {omg: {no: "OMG!"}, outer: [{ inner: [{ yes: 'no', text: "goodbye" }] }] }; + + shouldCompileTo(string, [hash, undefined, undefined, true], "Goodbye cruel "); + }); + }); }); |