diff options
author | Pieter van de Bruggen <pvande@gmail.com> | 2010-10-22 13:51:42 -0700 |
---|---|---|
committer | Pieter van de Bruggen <pvande@gmail.com> | 2010-10-22 13:55:00 -0700 |
commit | ad65c36053f9b1a5315c80608b67567f9d6e9880 (patch) | |
tree | b4f75372f29a0ab6447c0e02b86e497492db289c /specs | |
parent | 90d50e1359aefad4bcacbae21cd908a8d1f779d6 (diff) | |
download | mustache-spec-ad65c36053f9b1a5315c80608b67567f9d6e9880.tar.gz |
Consolidating and defining partial specs.
Diffstat (limited to 'specs')
-rw-r--r-- | specs/partials.yml | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/specs/partials.yml b/specs/partials.yml index 3337da1..ad7f4eb 100644 --- a/specs/partials.yml +++ b/specs/partials.yml @@ -1,35 +1,41 @@ tests: - - name: Basic Behavior Using '>' + - name: '>' + desc: The greater-than operator should expand to the named partial. data: { } template: '"{{>text}}"' partials: { text: 'from partial' } expected: '"from partial"' - - name: Basic Behavior Using '<' + - name: '<' + desc: The less-than operator should expand to the named partial. data: { } template: '"{{<text}}"' partials: { text: 'from partial' } expected: '"from partial"' - - name: Grabbing Context Using '>' + - name: '> - Context' + desc: The greater-than operator should operate within the current context. data: { text: 'content' } template: '"{{>partial}}"' partials: { partial: '*{{text}}*' } expected: '"*content*"' - - name: Grabbing Context Using '<' + - name: '< - Context' + desc: The less-than operator should operate within the current context. data: { text: 'content' } template: '"{{<partial}}"' partials: { partial: '*{{text}}*' } expected: '"*content*"' - - name: Recursion Using '>' + - name: '> - Recursion' + desc: The greater-than operator should properly recurse. data: { content: X, nodes: [ { content: Y, nodes: [] } ] } template: '{{>node}}' partials: { node: '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>' } expected: 'X<Y<>>' - - name: Recursion Using '<' + - name: '< - Recursion' + desc: The greater-than operator should properly recurse. data: { content: X, nodes: [ { content: Y, nodes: [] } ] } template: '{{<node}}' partials: { node: '{{content}}<{{#nodes}}{{<node}}{{/nodes}}>' } @@ -37,31 +43,36 @@ tests: # Whitespace Sensitivity - - name: Respects Surrounding Whitespace Using '>' + - name: '> - Surrounding Whitespace' + desc: The greater-than operator should not alter surrounding whitespace. data: { } template: '| {{>partial}} |' partials: { partial: "\t|\t" } expected: "| \t|\t |" - - name: Respects Surrounding Whitespace Using '<' + - name: '< - Surrounding Whitespace' + desc: The less-than operator should not alter surrounding whitespace. data: { } template: '| {{<partial}} |' partials: { partial: "\t|\t" } expected: "| \t|\t |" - - name: Respects Indentation of Other Content Using '>' + - name: '> - Inline Indentation' + desc: Whitespace should be left untouched. data: { data: '|' } template: " {{data}} {{> partial}}\n" partials: { partial: ">\n>" } expected: " | >\n>\n" - - name: Respects Indentation of Other Content Using '<' + - name: '< - Inline Indentation' + desc: Whitespace should be left untouched. data: { data: '|' } template: " {{data}} {{< partial}}\n" partials: { partial: "<\n<" } expected: " | <\n<\n" - - name: Respects Indentation Using '>' + - name: '> - Standalone Indentation' + desc: Indentation should be prepended to each line of the partial. data: { } template: | \ @@ -77,7 +88,8 @@ tests: | / - - name: Respects Indentation Using '<' + - name: '< - Standalone Indentation' + desc: Indentation should be prepended to each line of the partial. data: { } template: | \ @@ -95,13 +107,15 @@ tests: # Whitespace Insensitivity - - name: Ignores Padding Whitespace Using '>' + - name: '> - Padding Whitespace' + desc: Superfluous in-tag whitespace should be ignored. data: { boolean: true } template: "|{{> partial }}|" partials: { partial: "=" } expected: '|=|' - - name: Ignores Padding Whitespace Using '<' + - name: '< - Padding Whitespace' + desc: Superfluous in-tag whitespace should be ignored. data: { boolean: true } template: "|{{< partial }}|" partials: { partial: "=" } |