diff options
author | Pieter van de Bruggen <pvande@gmail.com> | 2010-12-11 23:17:05 -0800 |
---|---|---|
committer | Pieter van de Bruggen <pvande@gmail.com> | 2010-12-11 23:17:05 -0800 |
commit | c9ddab317be09adccc66983060534e6c20968b03 (patch) | |
tree | 93e713cfc7ca3ef8f3a91d4c5e33c2d4e6d4023e | |
parent | 29b50f1124ce9bee7a5e15557e0ea32a1bc5b2ab (diff) | |
download | mustache-spec-c9ddab317be09adccc66983060534e6c20968b03.tar.gz |
Adding a spec for deeply nested sections.
-rw-r--r-- | specs/sections.yml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/specs/sections.yml b/specs/sections.yml index e0e08cf..cc3d330 100644 --- a/specs/sections.yml +++ b/specs/sections.yml @@ -17,6 +17,45 @@ tests: template: '"{{#context}}Hi {{name}}.{{/context}}"' expected: '"Hi Joe."' + - name: Deeply Nested Contexts + desc: All elements on the context stack should be accessible. + data: + a: { one: 1 } + b: { two: 2 } + c: { three: 3 } + d: { four: 4 } + e: { five: 5 } + template: | + {{#a}} + {{one}} + {{#b}} + {{one}}{{two}}{{one}} + {{#c}} + {{one}}{{two}}{{three}}{{two}}{{one}} + {{#d}} + {{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}} + {{#e}} + {{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}} + {{/e}} + {{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}} + {{/d}} + {{one}}{{two}}{{three}}{{two}}{{one}} + {{/c}} + {{one}}{{two}}{{one}} + {{/b}} + {{one}} + {{/a}} + expected: | + 1 + 121 + 12321 + 1234321 + 123454321 + 1234321 + 12321 + 121 + 1 + - name: List desc: Lists should be iterated; list items should visit the context stack. data: { list: [ { n: 1 }, { n: 2 }, { n: 3 } ] } |