Skip to content

Commit b52a267

Browse files
Merge pull request #15 from ericalli/main
Fixing issue #9 with tests
2 parents 0b7ba05 + 44364ca commit b52a267

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
@@ -344,6 +344,14 @@ describe('Test async helpers', () => {
344344
should.equal(result, expected)
345345
})
346346

347+
it('Test each helper with an empty item list', async () => {
348+
const hbs = asyncHelpers(Handlebars)
349+
350+
const items = [],
351+
result = await hbs.compile('Devs \n{{#each items}}{{/each}}')({items})
352+
should.equal(result, 'Devs \n')
353+
})
354+
347355
it('check version', () => {
348356
const hbs = asyncHelpers(Handlebars)
349357
should(hbs.ASYNC_VERSION).equal(require('../package.json').version)

0 commit comments

Comments
 (0)