diff options
author | Pieter van de Bruggen <pvande@gmail.com> | 2010-12-20 17:27:52 -0800 |
---|---|---|
committer | Pieter van de Bruggen <pvande@gmail.com> | 2010-12-20 17:27:52 -0800 |
commit | 61d47607a9156ce0c49d12a3d7cf9e46ea1a6c68 (patch) | |
tree | 3cdca6d461400ffa9deeeaa4f7116923555e8286 | |
parent | 3d01a7b5c89979ce00e1fef18b0723a268e34c0d (diff) | |
download | mustache-spec-61d47607a9156ce0c49d12a3d7cf9e46ea1a6c68.tar.gz |
Adding a few specs for the Set Delimiter tags.v1.0.0rc2
Generalized, these tests ensure that delimiter context does
not extend across compilation unit boundaries, and that naïve
template caching mechanisms don't behave unexpectedly around
changing delimiters.
-rw-r--r-- | specs/delimiters.yml | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/specs/delimiters.yml b/specs/delimiters.yml index 2e61bbc..011a04a 100644 --- a/specs/delimiters.yml +++ b/specs/delimiters.yml @@ -11,6 +11,81 @@ tests: template: '({{=[ ]=}}[text])' expected: '(It worked!)' + - name: Sections + desc: Delimiters set outside sections should persist. + data: { section: true, data: 'I got interpolated.' } + template: | + [ + {{#section}} + {{data}} + |data| + {{/section}} + + {{= | | =}} + |#section| + {{data}} + |data| + |/section| + ] + expected: | + [ + I got interpolated. + |data| + + {{data}} + I got interpolated. + ] + + - name: Inverted Sections + desc: Delimiters set outside inverted sections should persist. + data: { section: false, data: 'I got interpolated.' } + template: | + [ + {{^section}} + {{data}} + |data| + {{/section}} + + {{= | | =}} + |^section| + {{data}} + |data| + |/section| + ] + expected: | + [ + I got interpolated. + |data| + + {{data}} + I got interpolated. + ] + + - name: Partial Inheritence + desc: Delimiters set in a parent template should not affect a partial. + data: { value: 'yes' } + partials: + include: '.{{value}}.' + template: | + [ {{>include}} ] + {{= | | =}} + [ |>include| ] + expected: | + [ .yes. ] + [ .yes. ] + + - name: Post-Partial Behavior + desc: Delimiters set in a partial should not affect the parent template. + data: { value: 'yes' } + partials: + include: '.{{value}}. {{= | | =}} .|value|.' + template: | + [ {{>include}} ] + [ .{{value}}. .|value|. ] + expected: | + [ .yes. .yes. ] + [ .yes. .|value|. ] + # Whitespace Sensitivity - name: Surrounding Whitespace |