summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter van de Bruggen <pvande@gmail.com>2010-11-07 22:19:06 -0800
committerPieter van de Bruggen <pvande@gmail.com>2010-11-07 22:31:02 -0800
commitf133430e78724fb57782619cdaa5927edf4a26d8 (patch)
tree197b3af4359198ce6035282353b0e7ac4f3219da
parent9ff5442d15dec18da5df82dfc9646e8c23431315 (diff)
downloadmustache-spec-f133430e78724fb57782619cdaa5927edf4a26d8.tar.gz
Pruning back the Partials specs.
While the Ruby implementation (currently) treats both greater- than and less-than sigils identically, it's unfair to demand that behavior from all implementations. In the future, this may change, or may support some alternate functionality (e.g. inline partial definitions).
-rw-r--r--specs/partials.yml73
1 files changed, 7 insertions, 66 deletions
diff --git a/specs/partials.yml b/specs/partials.yml
index ad7f4eb..424e650 100644
--- a/specs/partials.yml
+++ b/specs/partials.yml
@@ -1,77 +1,42 @@
tests:
- - name: '>'
+ - name: Basic Behavior
desc: The greater-than operator should expand to the named partial.
data: { }
template: '"{{>text}}"'
partials: { text: 'from partial' }
expected: '"from partial"'
- - name: '<'
- desc: The less-than operator should expand to the named partial.
- data: { }
- template: '"{{<text}}"'
- partials: { text: 'from partial' }
- expected: '"from partial"'
-
- - name: '> - Context'
+ - name: Context
desc: The greater-than operator should operate within the current context.
data: { text: 'content' }
template: '"{{>partial}}"'
partials: { partial: '*{{text}}*' }
expected: '"*content*"'
- - 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'
+ - 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'
- 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<>>'
-
# Whitespace Sensitivity
- - name: '> - Surrounding Whitespace'
+ - name: Surrounding Whitespace
desc: The greater-than operator should not alter surrounding whitespace.
data: { }
template: '| {{>partial}} |'
partials: { partial: "\t|\t" }
expected: "| \t|\t |"
- - name: '< - Surrounding Whitespace'
- desc: The less-than operator should not alter surrounding whitespace.
- data: { }
- template: '| {{<partial}} |'
- partials: { partial: "\t|\t" }
- expected: "| \t|\t |"
-
- - name: '> - Inline Indentation'
+ - name: Inline Indentation
desc: Whitespace should be left untouched.
data: { data: '|' }
template: " {{data}} {{> partial}}\n"
partials: { partial: ">\n>" }
expected: " | >\n>\n"
- - name: '< - Inline Indentation'
- desc: Whitespace should be left untouched.
- data: { data: '|' }
- template: " {{data}} {{< partial}}\n"
- partials: { partial: "<\n<" }
- expected: " | <\n<\n"
-
- - name: '> - Standalone Indentation'
+ - name: Standalone Indentation
desc: Indentation should be prepended to each line of the partial.
data: { }
template: |
@@ -88,35 +53,11 @@ tests:
|
/
- - name: '< - Standalone Indentation'
- desc: Indentation should be prepended to each line of the partial.
- data: { }
- template: |
- \
- {{<partial}}
- /
- partials:
- partial: |
- |
- |
- expected: |
- \
- |
- |
- /
-
# Whitespace Insensitivity
- - name: '> - Padding Whitespace'
+ - name: Padding Whitespace
desc: Superfluous in-tag whitespace should be ignored.
data: { boolean: true }
template: "|{{> partial }}|"
partials: { partial: "=" }
expected: '|=|'
-
- - name: '< - Padding Whitespace'
- desc: Superfluous in-tag whitespace should be ignored.
- data: { boolean: true }
- template: "|{{< partial }}|"
- partials: { partial: "=" }
- expected: '|=|'