summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter van de Bruggen <pvande@gmail.com>2010-10-08 00:52:24 -0700
committerPieter van de Bruggen <pvande@gmail.com>2010-10-08 00:52:24 -0700
commit78b4209f959e962fabb86a30c359af405f044ea0 (patch)
tree8c103eaac4b7a313022b5d9ae0c6ea4c6628a1e2
parent280a4acd19e23d725b54a1cdadcf532baeb250fd (diff)
downloadmustache-spec-78b4209f959e962fabb86a30c359af405f044ea0.tar.gz
Factoring out the partials specs.
-rw-r--r--spec.yml102
-rw-r--r--specs/partials.yml100
2 files changed, 100 insertions, 102 deletions
diff --git a/spec.yml b/spec.yml
index 45e2274..72e8ab3 100644
--- a/spec.yml
+++ b/spec.yml
@@ -2,108 +2,6 @@
version: '0.0.1a'
tests:
- #########
- # Partals
-
- - name: Basic Partial Injection
- data: { }
- template: '<< {{>text}}'
- partials: { text: 'from partial' }
- expected: '<< from partial'
-
- - name: Basic Partial with Tags
- data: { text: 'content' }
- template: '<< {{>partial}}'
- partials: { partial: '*{{text}}*' }
- expected: '<< *content*'
-
- - name: Basic Partial Injection Using '<'
- data: { }
- template: '<< {{<text}}'
- partials: { text: 'from partial' }
- expected: '<< from partial'
-
- - name: Basic Partial with Tags Using '<'
- data: { text: 'content' }
- template: '<< {{<partial}}'
- partials: { partial: '*{{text}}*' }
- expected: '<< *content*'
-
- - name: Partial Indentation
- data: { text: 'content' }
- template: |
- ---
- {{>multiline}}
- ---
- partials:
- multiline: |
- A: {{text}}
- B: {{text}}
- C: {{text}}
- expected: |
- ---
- A: content
- B: content
- C: content
- ---
-
- - name: Recursive Partials
- 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: []
- template: |
- <ul>
- {{#nodes}}
- {{>node}}
- {{/nodes}}
- </ul>
- partials:
- node: |
- <li>
- {{content}}
- {{#nodes}}
- <ul>
- {{>node}}
- </ul>
- {{/nodes}}
- </li>
- 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>
-
###################
# In-Tag Whitespace
diff --git a/specs/partials.yml b/specs/partials.yml
new file mode 100644
index 0000000..fc132c5
--- /dev/null
+++ b/specs/partials.yml
@@ -0,0 +1,100 @@
+tests:
+ - name: Basic Behavior Using '>'
+ data: { }
+ template: '"{{>text}}"'
+ partials: { text: 'from partial' }
+ expected: '"from partial"'
+
+ - name: Basic Behavior Using '<'
+ data: { }
+ template: '<< {{<text}}'
+ partials: { text: 'from partial' }
+ expected: '<< from partial'
+
+ - name: Basic Behavior With Tags Using '>'
+ data: { text: 'content' }
+ template: '"{{>partial}}"'
+ partials: { partial: '*{{text}}*' }
+ expected: '"*content*"'
+
+ - name: Basic Behavior With Tags Using '<'
+ data: { text: 'content' }
+ template: '"{{<partial}}"'
+ partials: { partial: '*{{text}}*' }
+ expected: '"*content*"'
+
+ - name: Indentation
+ data: { text: 'content' }
+ template: |
+ ---
+ {{>multiline}}
+ ---
+ partials:
+ multiline: |
+ A: {{text}}
+ B: {{text}}
+ C: {{text}}
+ 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: []
+ template: |
+ <ul>
+ {{#nodes}}
+ {{>node}}
+ {{/nodes}}
+ </ul>
+ partials:
+ node: |
+ <li>
+ {{content}}
+ {{#nodes}}
+ <ul>
+ {{>node}}
+ </ul>
+ {{/nodes}}
+ </li>
+ 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