From 2c585cace9264b8543df44ca3ce56257425ac41c Mon Sep 17 00:00:00 2001 From: anomal00us <95467104+anomal00us@users.noreply.github.com> Date: Mon, 6 Dec 2021 14:29:37 +0100 Subject: Update dynamic.yml Update dynamic.yml --- specs/dynamic.yml | 22 ++++++++++++++++++---- 1 file 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>' # 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>" } -- cgit v1.2.1