File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -166,8 +166,8 @@ Visit the: [code](lib/comparison.js) | [unit tests](test/comparison.js) | [issue
166
166
* ** [ gt] ( #gt ) ** ([ code] ( lib/comparison.js#L182 ) | [ tests] ( test/comparison.js#L214 ) )
167
167
* ** [ gte] ( #gte ) ** ([ code] ( lib/comparison.js#L206 ) | [ tests] ( test/comparison.js#L245 ) )
168
168
* ** [ has] ( #has ) ** ([ code] ( lib/comparison.js#L226 ) | [ tests] ( test/comparison.js#L260 ) )
169
- * ** [ isFalsey] ( #isFalsey ) ** ([ code] ( lib/comparison.js#L268 ) | [ no tests] )
170
- * ** [ isTruthy] ( #isTruthy ) ** ([ code] ( lib/comparison.js#L283 ) | [ no tests] )
169
+ * ** [ isFalsey] ( #isFalsey ) ** ([ code] ( lib/comparison.js#L268 ) | [ tests] ( test/comparison.js#L327 ) )
170
+ * ** [ isTruthy] ( #isTruthy ) ** ([ code] ( lib/comparison.js#L283 ) | [ tests] ( test/comparison.js#L339 ) )
171
171
* ** [ ifEven] ( #ifEven ) ** ([ code] ( lib/comparison.js#L304 ) | [ tests] ( test/comparison.js#L344 ) )
172
172
* ** [ ifNth] ( #ifNth ) ** ([ code] ( lib/comparison.js#L321 ) | [ tests] ( test/comparison.js#L356 ) )
173
173
* ** [ ifOdd] ( #ifOdd ) ** ([ code] ( lib/comparison.js#L344 ) | [ tests] ( test/comparison.js#L379 ) )
Original file line number Diff line number Diff line change @@ -324,6 +324,30 @@ describe('comparison', function() {
324
324
} ) ;
325
325
} ) ;
326
326
327
+ describe ( 'isFalsey' , function ( ) {
328
+ it ( 'should render block if given value is falsey.' , function ( ) {
329
+ var fn = hbs . compile ( '{{#if (isFalsey value)}}A{{else}}B{{/if}}' ) ;
330
+ assert . equal ( fn ( { value : 'nope' } ) , 'A' ) ;
331
+ } ) ;
332
+
333
+ it ( 'should render inverse if given value is truthy' , function ( ) {
334
+ var fn = hbs . compile ( '{{#if (isFalsey value)}}A{{else}}B{{/if}}' ) ;
335
+ assert . equal ( fn ( { value : 'CCC' } ) , 'B' ) ;
336
+ } ) ;
337
+ } ) ;
338
+
339
+ describe ( 'isTruthy' , function ( ) {
340
+ it ( 'should render block if given value is truthy.' , function ( ) {
341
+ var fn = hbs . compile ( '{{#if (isTruthy value)}}A{{else}}B{{/if}}' ) ;
342
+ assert . equal ( fn ( { value : 'CCC' } ) , 'A' ) ;
343
+ } ) ;
344
+
345
+ it ( 'should render inverse if given value is not truthy' , function ( ) {
346
+ var fn = hbs . compile ( '{{#if (isTruthy value)}}A{{else}}B{{/if}}' ) ;
347
+ assert . equal ( fn ( { value : 'nope' } ) , 'B' ) ;
348
+ } ) ;
349
+ } ) ;
350
+
327
351
describe ( 'eq' , function ( ) {
328
352
it ( 'should render a block if the value is equal to a given number.' , function ( ) {
329
353
var fn = hbs . compile ( '{{#eq number compare=8}}A{{/eq}}' ) ;
You can’t perform that action at this time.
0 commit comments