Skip to content

Commit

Permalink
fix(template): template string in helper arguments weren't resolved
Browse files Browse the repository at this point in the history
Fixes #2411
  • Loading branch information
edvald authored and thsig committed Jan 14, 2022
1 parent 4a5e2a9 commit 0157fe0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/template-string/parser.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Arguments
}

ArgumentList
= head:Expression tail:(__ "," __ Expression)* {
= head:PrimaryExpression tail:(__ "," __ PrimaryExpression)* {
return buildList(head, tail, 3);
}

Expand Down
5 changes: 5 additions & 0 deletions core/test/unit/src/template-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,11 @@ describe("resolveTemplateString", async () => {
expect(res).to.equal("Zm9v")
})

it("resolves a template string in a helper argument", () => {
const res = resolveTemplateString("${base64Encode('${a}')}", new TestContext({ a: "foo" }))
expect(res).to.equal("Zm9v")
})

it("resolves a helper function with multiple arguments", () => {
const res = resolveTemplateString("${split('a,b,c', ',')}", new TestContext({}))
expect(res).to.eql(["a", "b", "c"])
Expand Down

0 comments on commit 0157fe0

Please sign in to comment.