summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter van de Bruggen <pvande@gmail.com>2010-11-17 18:14:49 -0800
committerPieter van de Bruggen <pvande@gmail.com>2010-11-17 18:14:49 -0800
commita61dea038ce38382dced750d9e3ba9ce588a776f (patch)
treefc55d389d9ac8c02e2a926a4fd8587a98896a0a0
parent8854760cb9b5984a526126d76826bd00e079242d (diff)
downloadmustache-spec-a61dea038ce38382dced750d9e3ba9ce588a776f.tar.gz
Untangling the inverted section specs.
-rw-r--r--specs/inverted.yml44
1 files changed, 26 insertions, 18 deletions
diff --git a/specs/inverted.yml b/specs/inverted.yml
index ed43175..fdd52fa 100644
--- a/specs/inverted.yml
+++ b/specs/inverted.yml
@@ -2,32 +2,32 @@ tests:
- name: Falsey
desc: Falsey sections should have their contents rendered.
data: { boolean: false }
- template: '{{^boolean}}This should be rendered.{{/boolean}}'
- expected: 'This should be rendered.'
+ template: '"{{^boolean}}This should be rendered.{{/boolean}}"'
+ expected: '"This should be rendered."'
- name: Truthy
desc: Truthy sections should have their contents omitted.
data: { boolean: true }
- template: '{{^boolean}}This should not be rendered.{{/boolean}}'
- expected: ''
+ template: '"{{^boolean}}This should not be rendered.{{/boolean}}"'
+ expected: '""'
- name: Context
desc: Objects and hashes should behave like truthy values.
data: { context: { name: 'Joe' } }
- template: '{{^context}}Hi {{name}}.{{/context}}'
- expected: ''
+ template: '"{{^context}}Hi {{name}}.{{/context}}"'
+ expected: '""'
- name: List
desc: Lists should behave like truthy values.
data: { list: [ { n: 1 }, { n: 2 }, { n: 3 } ] }
- template: '{{^list}}{{n}}{{/list}}'
- expected: ''
+ template: '"{{^list}}{{n}}{{/list}}"'
+ expected: '""'
- name: Empty List
desc: Empty lists should behave like falsey values.
data: { list: [ ] }
- template: '{{^list}}Yay lists!{{/list}}'
- expected: 'Yay lists!'
+ template: '"{{^list}}Yay lists!{{/list}}"'
+ expected: '"Yay lists!"'
- name: Doubled
desc: Multiple inverted sections per template should be permitted.
@@ -57,21 +57,29 @@ tests:
desc: Standalone lines should be removed from the template.
data: { boolean: false }
template: |
- | This
+ | This Is
{{^boolean}}
- | Is
+ |
{{/boolean}}
+ | A Line
+ expected: |
+ | This Is
|
+ | A Line
+
+ - name: Standalone Indented Lines
+ desc: Standalone indented lines should be removed from the template.
+ data: { boolean: false }
+ template: |
+ | This Is
{{^boolean}}
- | A
+ |
{{/boolean}}
- | Line
+ | A Line
expected: |
- | This
- | Is
+ | This Is
|
- | A
- | Line
+ | A Line
# Whitespace Insensitivity