diff --git a/src/Tags/IncludeTag.js b/src/Tags/IncludeTag.js index 108568b..7495bed 100644 --- a/src/Tags/IncludeTag.js +++ b/src/Tags/IncludeTag.js @@ -52,7 +52,7 @@ class IncludeTag extends BaseTag { * @return {Array} */ get allowedExpressions () { - return ['Literal', 'Identifier', 'MemberExpression'] + return ['Literal', 'Identifier', 'MemberExpression', 'CallExpression'] } /** diff --git a/test/unit/tags/include.spec.js b/test/unit/tags/include.spec.js index 667bc51..306523c 100644 --- a/test/unit/tags/include.spec.js +++ b/test/unit/tags/include.spec.js @@ -83,4 +83,17 @@ test.group('Tags | Include ', (group) => {

Foo

`) }) + + test('call a function inside include', (assert) => { + const statement = `@include(getFile('includes.user-profile'))` + + const template = new Template(this.tags, {}, {}, loader) + const output = template.renderString(statement, { + username: 'Foo', + getFile (input) { return input } + }) + assert.equal(output.trim(), dedent`

User Profile

+

Foo

+ `) + }) })