isEmpty test

This commit is contained in:
kpdecker
2013-04-06 14:26:08 -05:00
parent 9e4b59e815
commit fe74d65f2b
+15
View File
@@ -1403,3 +1403,18 @@ test('GS-428: Nested if else rendering', function() {
shouldCompileTo(succeedingTemplate, [{}, helpers], ' Expected ');
shouldCompileTo(failingTemplate, [{}, helpers], ' Expected ');
});
suite('Utils');
test('isEmpty', function() {
equal(Handlebars.Utils.isEmpty(undefined), true);
equal(Handlebars.Utils.isEmpty(null), true);
equal(Handlebars.Utils.isEmpty(false), true);
equal(Handlebars.Utils.isEmpty(''), true);
equal(Handlebars.Utils.isEmpty([]), true);
equal(Handlebars.Utils.isEmpty(0), false);
equal(Handlebars.Utils.isEmpty([1]), false);
equal(Handlebars.Utils.isEmpty('foo'), false);
equal(Handlebars.Utils.isEmpty({bar: 1}), false);
});