summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter van de Bruggen <pvande@gmail.com>2010-10-20 23:05:33 -0700
committerPieter van de Bruggen <pvande@gmail.com>2010-10-20 23:13:05 -0700
commit329773b9845692454dee2e163e345d62ca3db0e4 (patch)
treec83fa8f97b7ef3c7783db870dcdd53d7b8c25317
parent5fc563e4e33be9ec821fc2789b89c95a849a6192 (diff)
downloadmustache-spec-329773b9845692454dee2e163e345d62ca3db0e4.tar.gz
Consolidating and describing interpolation specs.
-rw-r--r--specs/interpolation.yml42
1 files changed, 28 insertions, 14 deletions
diff --git a/specs/interpolation.yml b/specs/interpolation.yml
index b6fc8a5..d1fc6b9 100644
--- a/specs/interpolation.yml
+++ b/specs/interpolation.yml
@@ -1,33 +1,38 @@
tests:
- name: No Interpolation
+ desc: Mustache-free templates should render as-is.
data: { }
template: |
- Hello from Mustache!
+ Hello from {Mustache}!
expected: |
- Hello from Mustache!
+ Hello from {Mustache}!
- name: Basic Interpolation
+ desc: Unadorned tags should interpolate content into the template.
data: { subject: "world" }
template: |
Hello, {{subject}}!
expected: |
Hello, world!
- - name: Escaped Interpolation
+ - name: HTML Escaping
+ desc: Basic interpolation should be HTML escaped.
data: { forbidden: '& " < >' }
template: |
These characters should be HTML escaped: {{forbidden}}
expected: |
These characters should be HTML escaped: &amp; &quot; &lt; &gt;
- - name: Unescaped via Triple Mustache
+ - name: Triple Mustache
+ desc: Triple mustaches should interpolate without HTML escaping.
data: { forbidden: '& " < >' }
template: |
These characters should not be HTML escaped: {{{forbidden}}}
expected: |
These characters should not be HTML escaped: & " < >
- - name: Unescaped via the Ampersand
+ - name: Ampersand
+ desc: Ampersand should interpolate without HTML escaping.
data: { forbidden: '& " < >' }
template: |
These characters should not be HTML escaped: {{&forbidden}}
@@ -36,49 +41,58 @@ tests:
# Whitespace Sensitivity
- - name: Interpolation Respects Surrounding Whitespace
+ - name: Interpolation - Surrounding Whitespace
+ desc: Interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: '| {{string}} |'
expected: '| --- |'
- - name: Triple Mustache Respects Surrounding Whitespace
+ - name: Triple Mustache - Surrounding Whitespace
+ desc: Interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: '| {{{string}}} |'
expected: '| --- |'
- - name: Ampersand Respects Surrounding Whitespace
+ - name: Ampersand - Surrounding Whitespace
+ desc: Interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: '| {{&string}} |'
expected: '| --- |'
- - name: Interpolation Respects Indentation When Standalone
+ - name: Interpolation - Standalone
+ desc: Standalone interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: " {{string}}\n"
expected: " ---\n"
- - name: Triple Mustache Respects Indentation When Standalone
+ - name: Triple Mustache - Standalone
+ desc: Standalone interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: " {{{string}}}\n"
expected: " ---\n"
- - name: Ampersand Respects Indentation When Standalone
+ - name: Ampersand - Standalone
+ desc: Standalone interpolation should not alter surrounding whitespace.
data: { string: '---' }
template: " {{&string}}\n"
expected: " ---\n"
# Whitespace Insensitivity
- - name: Interpolation Ignores Padding Whitespace
+ - name: Interpolation With Padding
+ desc: Superfluous in-tag whitespace should be ignored.
data: { string: "---" }
template: '|{{ string }}|'
expected: '|---|'
- - name: Triple Mustache Ignores Padding Whitespace
+ - name: Triple Mustache With Padding
+ desc: Superfluous in-tag whitespace should be ignored.
data: { string: "---" }
template: '|{{{ string }}}|'
expected: '|---|'
- - name: Ampersand Ignores Padding Whitespace
+ - name: Ampersand With Padding
+ desc: Superfluous in-tag whitespace should be ignored.
data: { string: "---" }
template: '|{{& string }}|'
expected: '|---|'