Skip to content

Commit

Permalink
feat(export.renderer.FluidLiteralNodeRenderer): now replaces boolean … (
Browse files Browse the repository at this point in the history
#4)

feat(export.renderer.FluidLiteralNodeRenderer): now replaces boolean types true/false with 1/0, adapts fixtures
  • Loading branch information
nmaier95 authored and ChristianAuth committed Feb 1, 2018
1 parent 46f4e21 commit 712c1c2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/export/renderer/FluidLiteralNodeRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ class FluidLiteralNodeRenderer extends NodeRenderer
{
result+= node.value.replace(/"/g, '\\"');
}
else if(node.valueType == 'boolean')
{
node.value === true ? result+= '1' : result+= '0';
}
else
{
result+= node.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
'primary'
<!-- arguments -->
primary
<!-- boolean -->
1
0
10
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
{% macro e_cta(type='primary') %}{% endmacro %}
<!-- arguments -->
{{ e_cta(type='primary') }}
<!-- boolean -->
{{ true }}
{{ false }}
{% if model.copy == true or model.copy == false %}{% endif %}
2 changes: 2 additions & 0 deletions test/__fixtures__/renderer/conditions.expected.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
SEARCH
</f:else></f:if>
<f:if condition="{text -> e:trim()} != ''">TEXT</f:if>
<f:if condition="{model.copy} == 1">TEXT</f:if>
<f:if condition="{model.copy} == 0">TEXT</f:if>
2 changes: 2 additions & 0 deletions test/__fixtures__/renderer/conditions.input.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
SEARCH
{% endif %}
{% if text|trim != '' %}TEXT{% endif %}
{% if model.copy == true %}TEXT{% endif %}
{% if model.copy == false %}TEXT{% endif %}

0 comments on commit 712c1c2

Please sign in to comment.