Conformance Examples 0.1.0 — Render: if-block¶
if-doubled-adjacent-if-same-key¶
Two adjacent {{#if}} blocks over the same key render independently; the second is unaffected by the first.
Template
Context
Output
if-else-if-all-falsy-no-else-emits-nothing¶
Every arm falsy and no else arm: nothing is emitted.
Template
Context
Output
if-else-if-all-falsy-with-else-renders-else¶
Every arm falsy with an else arm present: the else body renders.
Template
Context
Output
if-else-if-first-arm-wins¶
First arm truthy: its body renders and later arms are skipped.
Template
Context
Output
if-else-if-second-arm-wins-when-first-falsy¶
First arm falsy, second arm truthy: second arm's body renders.
Template
Context
Output
if-else-if-third-arm-wins-when-first-two-falsy¶
First two arms falsy, third truthy: third arm's body renders.
Template
Context
Output
if-empty-array-is-falsy¶
An empty JsonArray is falsy: the else arm renders.
Template
Context
Output
if-empty-object-is-truthy¶
An empty JsonObject is truthy (matches Handlebars): the body renders.
Template
Context
Output
if-empty-string-is-falsy¶
An empty string is falsy: the else arm renders.
Template
Context
Output
if-false-no-else-emits-nothing¶
Identifier resolves to false and there is no else arm: emits nothing.
Template
Context
Output
if-false-with-else-renders-else¶
Identifier resolves to false and an else arm is present: the else arm renders.
Template
Context
Output
if-jsonnull-is-falsy¶
An explicit JsonNull value is falsy.
Template
Context
Output
if-missing-key-treated-as-falsy¶
A missing key resolves to null and is treated as falsy: the else arm renders.
Template
Context
Output
if-multiple-spaces-between-else-and-if¶
Whitespace between 'else' and 'if' is permitted (spaces and tabs).
Template
Context
Output
if-nested-inside-each-with-parent-pointer¶
Sanity: {{#if}} inside {{#each}} can address the current item and a parent value.
Template
Context
{
"items": [
{
"name": "a",
"active": true
},
{
"name": "b",
"active": false
},
{
"name": "c",
"active": true
}
]
}
Output
if-true-renders-body¶
Identifier resolves to true: the body renders.
Template
Context
Output
if-zero-is-falsy¶
The number 0 is falsy: the else arm renders.
Template
Context
Output
Source fixture: render/if-block.json