summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranomal00us <95467104+anomal00us@users.noreply.github.com>2021-12-06 14:29:37 +0100
committerroot <root@delphi.lan>2022-08-08 21:07:01 +0200
commit2c585cace9264b8543df44ca3ce56257425ac41c (patch)
treeb59b4a9cc40f953aa359a8c1a5d3cee7e0b4fc41
parentb5ec88ffdde7fdc168a89aefeaa08a0f0051357b (diff)
downloadmustache-spec-2c585cace9264b8543df44ca3ce56257425ac41c.tar.gz
Update dynamic.yml
Update dynamic.yml
-rw-r--r--specs/dynamic.yml22
1 files changed, 18 insertions, 4 deletions
diff --git a/specs/dynamic.yml b/specs/dynamic.yml
index 1b2390c..c61113e 100644
--- a/specs/dynamic.yml
+++ b/specs/dynamic.yml
@@ -17,7 +17,9 @@ overview: |
Dynamic partial tags SHOULD be treated as standalone when appropriate. If
this tag is used standalone, any whitespace preceding the tag should treated
- as indentation, and prepended to each line of the partial before rendering.
+ as indentation, and prepended to each line of the partial before rendering:
+ whitespace handling around dynamic partials SHOULD be identical to whitespace
+ handling around static (normal) partials.
tests:
- name: Basic Behavior
desc: The asterisk operator is used for dynamic partials.
@@ -33,6 +35,13 @@ tests:
partials: { }
expected: '""'
+ - name: Context Misses Again
+ desc: Failed context lookups should be considered falsey.
+ data: { }
+ template: '"{{*missing}}"'
+ partials: { missing: 'Hello, world!' }
+ expected: '""'
+
- name: Failed Lookup
desc: The empty string should be used when the named partial is not found.
data: { dynamic: 'content' }
@@ -56,20 +65,25 @@ tests:
nodes: [ { content: 'Y', nodes: [] } ]
}
template: '{{*template}}'
- partials: { node: '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>' }
+ partials: { node: '{{content}}<{{#nodes}}{{*template}}{{/nodes}}>' }
expected: 'X<Y<>>'
# Whitespace Sensitivity
- name: Surrounding Whitespace
- desc: The asterisk operator should not alter surrounding whitespace.
+ desc: |
+ The asterisk operator should not alter surrounding whitespace; any
+ whitespace preceding the tag should treated as indentation while any
+ whitepsace succeding the tag should be left untouched.
data: { partial: 'foobar' }
template: '| {{*partial}} |'
partials: { foobar: "\t|\t" }
expected: "| \t|\t |"
- name: Inline Indentation
- desc: Whitespace should be left untouched.
+ desc: |
+ Whitespace should be left untouched: whitespaces preceding the tag
+ should be treated as indentation.
data: { dynamic: 'partial', data: '|' }
template: " {{data}} {{* dynamic}}\n"
partials: { partial: ">\n>" }