Skip to content

Commit 52d9d10

Browse files
authored
Merge pull request #1 from ericalli/main
Fixing issue gastonrobledo#9 with tests
2 parents 3eeec4b + 44364ca commit 52d9d10

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

helpers/each.js

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ module.exports = (handlebars) => {
103103

104104
if (i === 0) {
105105
ret = inverse(this)
106+
ret = [inverse(this)]
106107
}
107108

108109
return ret.join('')

test/test.js

+8
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,14 @@ describe('Test async helpers', () => {
363363
should.equal(result, expected)
364364
})
365365

366+
it('Test each helper with an empty item list', async () => {
367+
const hbs = asyncHelpers(Handlebars)
368+
369+
const items = [],
370+
result = await hbs.compile('Devs \n{{#each items}}{{/each}}')({items})
371+
should.equal(result, 'Devs \n')
372+
})
373+
366374
it('check version', () => {
367375
const hbs = asyncHelpers(Handlebars)
368376
should(hbs.ASYNC_VERSION).equal(require('../package.json').version)

0 commit comments

Comments
 (0)