summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter van de Bruggen <pvande@gmail.com>2010-10-11 19:18:02 -0700
committerPieter van de Bruggen <pvande@gmail.com>2010-10-11 19:18:02 -0700
commit39c8311013c1333e4de1de09efaac549a833ddd2 (patch)
treed19eedb9ccafb7939ca0b76bcbbbdcefe3d35507
parent92e8f2f844205e27bf23314318d30135294e41a4 (diff)
downloadmustache-spec-39c8311013c1333e4de1de09efaac549a833ddd2.tar.gz
Adding a number of indentation-related specs.
-rw-r--r--specs/comments.yml5
-rw-r--r--specs/delimiters.yml10
-rw-r--r--specs/interpolation.yml15
-rw-r--r--specs/inverted.yml5
-rw-r--r--specs/partials.yml12
-rw-r--r--specs/sections.yml4
6 files changed, 46 insertions, 5 deletions
diff --git a/specs/comments.yml b/specs/comments.yml
index eb714c3..4ae6173 100644
--- a/specs/comments.yml
+++ b/specs/comments.yml
@@ -4,6 +4,11 @@ tests:
template: '12345{{! Comment Block! }}67890'
expected: '1234567890'
+ - name: Indented Inline
+ data: { }
+ template: ' 12 {{! 34 }}'
+ expected: ' 12 '
+
- name: Multiline
data: { }
template: |
diff --git a/specs/delimiters.yml b/specs/delimiters.yml
index 8f6888a..a18adf0 100644
--- a/specs/delimiters.yml
+++ b/specs/delimiters.yml
@@ -21,6 +21,16 @@ tests:
template: '| {{=@ @=}} |'
expected: '| |'
+ - name: Inlined Single Sigil Respects Indentation
+ data: { }
+ template: ' | {{=@ @}}'
+ expected: ' | '
+
+ - name: Inlined Mirrored Sigil Respects Indentation
+ data: { }
+ template: ' | {{=@ @=}}'
+ expected: ' | '
+
- name: Disregard Single Sigil Line
data: { }
template: |
diff --git a/specs/interpolation.yml b/specs/interpolation.yml
index ac22213..3937c79 100644
--- a/specs/interpolation.yml
+++ b/specs/interpolation.yml
@@ -51,6 +51,21 @@ tests:
template: '| {{&string}} |'
expected: '| --- |'
+ - name: Interpolation Respects Indentation When Standalone
+ data: { string: '---' }
+ template: " {{string}}\n"
+ expected: " ---"
+
+ - name: Triple Mustache Respects Indentation When Standalone
+ data: { string: '---' }
+ template: " {{{string}}}\n"
+ expected: " ---"
+
+ - name: Ampersand Respects Indentation When Standalone
+ data: { string: '---' }
+ template: " {{&string}}\n"
+ expected: " ---"
+
# Whitespace Insensitivity
- name: Interpolation Ignores Padding Whitespace
diff --git a/specs/inverted.yml b/specs/inverted.yml
index 6adc079..6d75698 100644
--- a/specs/inverted.yml
+++ b/specs/inverted.yml
@@ -39,13 +39,12 @@ tests:
* second
* third
-
# Whitespace Sensitivity
- name: Respects Surrounding Whitespace
data: { boolean: false }
- template: "| {{^boolean}}\t|\t{{/boolean}} |"
- expected: "| \t|\t |"
+ template: " | {{^boolean}}\t|\t{{/boolean}} | \n"
+ expected: " | \t|\t | \n"
- name: Disregard Standalone Lines
data: { boolean: false }
diff --git a/specs/partials.yml b/specs/partials.yml
index 05aac6a..3337da1 100644
--- a/specs/partials.yml
+++ b/specs/partials.yml
@@ -49,6 +49,18 @@ tests:
partials: { partial: "\t|\t" }
expected: "| \t|\t |"
+ - name: Respects Indentation of Other Content Using '>'
+ data: { data: '|' }
+ template: " {{data}} {{> partial}}\n"
+ partials: { partial: ">\n>" }
+ expected: " | >\n>\n"
+
+ - name: Respects Indentation of Other Content Using '<'
+ data: { data: '|' }
+ template: " {{data}} {{< partial}}\n"
+ partials: { partial: "<\n<" }
+ expected: " | <\n<\n"
+
- name: Respects Indentation Using '>'
data: { }
template: |
diff --git a/specs/sections.yml b/specs/sections.yml
index 84af057..6ecfaa1 100644
--- a/specs/sections.yml
+++ b/specs/sections.yml
@@ -43,8 +43,8 @@ tests:
- name: Respects Surrounding Whitespace
data: { boolean: true }
- template: "| {{#boolean}}\t|\t{{/boolean}} |"
- expected: "| \t|\t |"
+ template: " | {{#boolean}}\t|\t{{/boolean}} | \n"
+ expected: " | \t|\t | \n"
- name: Disregard Standalone Lines
data: { boolean: true }