duster/js/test_cases/helpers_select/main.dust

125 lines
4.1 KiB
Plaintext

Simple select{~n}
============={~n}
{@select key=pet}
{@eq value="cat"}Lets name your pet fluffy{~n}{/eq}
{@eq value="dog"}Lets name your pet rover{~n}{/eq}
{@eq value="lizard"}Lets name your pet dave{~n}{/eq}
{/select}
non-comparison bodies inside select{~n}
==================================={~n}
{@select key=pet}
text not inside a comparison{~n}
{@eq value="cat"}Lets name your pet fluffy{~n}{/eq}
{@eq value="dog"}Lets name your pet rover{~n}{/eq}
{@eq value="lizard"}Lets name your pet dave{~n}{/eq}
{/select}
@any{~n}
===={~n}
{@select key=pet}
{@any}{person} has a pet!{~n}{/any}
{@eq value="cat"}Lets name your pet fluffy{~n}{/eq}
{@eq value="dog"}Lets name your pet rover{~n}{/eq}
{@eq value="lizard"}Lets name your pet dave{~n}{/eq}
{/select}
@none{~n}
====={~n}
{@select key=pet}
{@any}{person} has a pet!{~n}{/any}
{@none}I don't know what to name {person}'s pet...{~n}{/none}
{@eq value="dog"}Lets name your pet rover{~n}{/eq}
{@eq value="lizard"}Lets name your pet dave{~n}{/eq}
{/select}
Is key added to the context?{~n}
============================{~n}
{@select key=pet}
{key}{~n}
{@any}{person} has a pet!{~n}{/any}
{/select}{~n}
Conditionals inside loop sections{~n}
================================={~n}
{@select key=pet}
{@any}{person} has a pet!{~n}{/any}
{#pet_names}
{@eq value=type}Lets name your pet {pet_name}{~n}{/eq}
{/pet_names}
{@none}I don't know what to name {person}'s pet...{~n}{/none}
{/select}{~n}
Conditionals inside scalar sections{~n}
==================================={~n}
{@select key=pet}
{@any}{person} has a pet!{~n}{/any}
{#scalar}
{@eq value="cat"}Lets name your pet fluffy{~n}{/eq}
{@eq value="dog"}Lets name your pet rover{~n}{/eq}
{@eq value="lizard"}Lets name your pet dave{~n}{/eq}
{/scalar}
{/select}{~n}
Sections inside select without conditionals{~n}
==========================================={~n}
{@select key=pet}
{@any}{person} has a pet!{~n}{/any}
{#pet_names}
If your pet was a {type} we'd name it {pet_name}{~n}
{/pet_names}
{@eq value="cat"}Lets name your pet fluffy{~n}{/eq}
{@eq value="dog"}Lets name your pet rover{~n}{/eq}
{@eq value="lizard"}Lets name your pet dave{~n}{/eq}
{/select}{~n}
Early termination{~n}
================={~n}
{@select key=pet}
{@eq value="cat"}Lets name your pet fluffy{~n}{/eq}
{@eq value="cat"}Lets name your pet whiskers{~n}{/eq}
{@eq value="dog"}Lets name your pet rover{~n}{/eq}
{@eq value="lizard"}Lets name your pet dave{~n}{/eq}
{@any}{person} has a pet!{~n}{/any}
text not inside a comparison{~n}
{#pet_names}
If your pet was a {type} we'd name it {pet_name}{~n}
{/pet_names}
{/select}{~n}
Early termination stand-alone comparison{~n}
========================================{~n}
{@select key=pet}
{@eq key="duck" value="duck"}Lets name your pet quackers{~n}{/eq}
{@eq value="cat"}Lets name your pet whiskers{~n}{/eq}
{@eq value="dog"}Lets name your pet rover{~n}{/eq}
{@eq value="lizard"}Lets name your pet dave{~n}{/eq}
{@any}{person} has a pet!{~n}{/any}
text not inside a comparison{~n}
{#pet_names}
If your pet was a {type} we'd name it {pet_name}{~n}
{/pet_names}
{/select}{~n}
Early termination else block{~n}
============================{~n}
{@select key=pet}
{@eq value="dog"}Lets name your pet rover{~n}{:else}Lets not name your pet rover{~n}{/eq}
{@eq value="cat"}Lets name your pet fluffy{~n}{:else}Lets not name your pet fluffy{~n}{/eq}
{@eq value="cat"}Lets name your pet whiskers{~n}{:else}Lets not name your pet whiskers{~n}{/eq}
{@eq value="lizard"}Lets name your pet dave{~n}{:else}Lets not name your pet dave{~n}{/eq}
{@any}{person} has a pet!{~n}{/any}
text not inside a comparison{~n}
{#pet_names}
If your pet was a {type} we'd name it {pet_name}{~n}
{/pet_names}
{/select}{~n}
@any alone{~n}
=========={~n}
{@any}{person} has a pet!{~n}{/any}
@none alone{~n}
==========={~n}
{@none}I don't know what to name {person}'s pet...{~n}{/none}