Skip to content

Commit

Permalink
runtime: support 0 input
Browse files Browse the repository at this point in the history
Fix: #79
  • Loading branch information
indutny committed Aug 3, 2015
1 parent 3629679 commit 6b9de40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bemhtml/runtime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ BEMHTML.prototype.transformEntities = function transformEntities(entities) {

BEMHTML.prototype._run = function _run(context) {
var res;
if (!context)
if (context === undefined || context === '' || context === null)
res = this.runEmpty();
else if (utils.isArray(context))
res = this.runMany(context);
Expand Down
10 changes: 10 additions & 0 deletions test/runtime-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,4 +680,14 @@ describe('BEMHTML compiler/Runtime', function() {
test(function() {
}, '', '');
});

it('should work with null input', function() {
test(function() {
}, null, '');
});

it('should work with 0 input', function() {
test(function() {
}, 0, '0');
});
});

0 comments on commit 6b9de40

Please sign in to comment.