Changed the internal 'if' helper such that it can test not only paths/variable names, but also numeric constants.

This will be helpful for subexpressions later, when testing numeric subexpressions return values,

eg: {{#if (eq 0 (mod @index 3))}}

Also added a test for this.
This commit is contained in:
majortom731 2014-03-12 16:59:54 +01:00
parent da443c5fd5
commit d7a9844e93

View File

@ -248,6 +248,16 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
'{{#bindAttr data}}',
array(),
'data'
),
array(
'{{#if 1}}ok{{else}}fail{{/if}}',
array(),
'ok'
),
array(
'{{#if 0}}ok{{else}}fail{{/if}}',
array(),
'fail'
)
);