diff options
author | Pieter van de Bruggen <pvande@gmail.com> | 2010-10-08 02:16:41 -0700 |
---|---|---|
committer | Pieter van de Bruggen <pvande@gmail.com> | 2010-10-08 02:16:41 -0700 |
commit | f9a385094381d1558089f0c05f4122d73e0bdf3a (patch) | |
tree | e57d26951cfa10971c7737aa8dc361acafebd8c2 | |
parent | ee75a7d2bd4adf69b21ac0151f685f3bad03b6a6 (diff) | |
download | mustache-spec-f9a385094381d1558089f0c05f4122d73e0bdf3a.tar.gz |
Cleaning up partials specs.
-rw-r--r-- | specs/partials.yml | 140 |
1 files changed, 68 insertions, 72 deletions
diff --git a/specs/partials.yml b/specs/partials.yml index fc132c5..05aac6a 100644 --- a/specs/partials.yml +++ b/specs/partials.yml @@ -7,94 +7,90 @@ tests: - name: Basic Behavior Using '<' data: { } - template: '<< {{<text}}' + template: '"{{<text}}"' partials: { text: 'from partial' } - expected: '<< from partial' + expected: '"from partial"' - - name: Basic Behavior With Tags Using '>' + - name: Grabbing Context Using '>' data: { text: 'content' } template: '"{{>partial}}"' partials: { partial: '*{{text}}*' } expected: '"*content*"' - - name: Basic Behavior With Tags Using '<' + - name: Grabbing Context Using '<' data: { text: 'content' } template: '"{{<partial}}"' partials: { partial: '*{{text}}*' } expected: '"*content*"' - - name: Indentation - data: { text: 'content' } + - name: Recursion Using '>' + data: { content: X, nodes: [ { content: Y, nodes: [] } ] } + template: '{{>node}}' + partials: { node: '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>' } + expected: 'X<Y<>>' + + - name: Recursion Using '<' + data: { content: X, nodes: [ { content: Y, nodes: [] } ] } + template: '{{<node}}' + partials: { node: '{{content}}<{{#nodes}}{{<node}}{{/nodes}}>' } + expected: 'X<Y<>>' + + # Whitespace Sensitivity + + - name: Respects Surrounding Whitespace Using '>' + data: { } + template: '| {{>partial}} |' + partials: { partial: "\t|\t" } + expected: "| \t|\t |" + + - name: Respects Surrounding Whitespace Using '<' + data: { } + template: '| {{<partial}} |' + partials: { partial: "\t|\t" } + expected: "| \t|\t |" + + - name: Respects Indentation Using '>' + data: { } template: | - --- - {{>multiline}} - --- + \ + {{>partial}} + / partials: - multiline: | - A: {{text}} - B: {{text}} - C: {{text}} + partial: | + | + | expected: | - --- - A: content - B: content - C: content - --- + \ + | + | + / - - name: Recursive - data: - nodes: - - content: 'First Parent' - nodes: - - content: "First Parent's First Child" - nodes: [] - - content: 'Second Parent' - nodes: [] - - content: 'Third Parent' - nodes: - - content: "Third Parent's First Child" - nodes: [] - - content: "Third Parent's Second Child" - nodes: [] + - name: Respects Indentation Using '<' + data: { } template: | - <ul> - {{#nodes}} - {{>node}} - {{/nodes}} - </ul> + \ + {{<partial}} + / partials: - node: | - <li> - {{content}} - {{#nodes}} - <ul> - {{>node}} - </ul> - {{/nodes}} - </li> + partial: | + | + | expected: | - <ul> - <li> - First Parent - <ul> - <li> - First Parent's First Child - </li> - </ul> - </li> - <li> - Second Parent - </li> - <li> - Third Parent - <ul> - <li> - Third Parent's First Child - </li> - <li> - Third Parent's Second Child - </li> - </ul> - </li> - </ul> -
\ No newline at end of file + \ + | + | + / + + # Whitespace Insensitivity + + - name: Ignores Padding Whitespace Using '>' + data: { boolean: true } + template: "|{{> partial }}|" + partials: { partial: "=" } + expected: '|=|' + + - name: Ignores Padding Whitespace Using '<' + data: { boolean: true } + template: "|{{< partial }}|" + partials: { partial: "=" } + expected: '|=|' |