From bb9dca204712cf4d9ff60dff36c4e53d1863336c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E6=B1=9F=E4=B8=9C=E5=8E=BB?= <6405352+dlxqlig@users.noreply.github.com> Date: Fri, 18 Oct 2019 03:04:52 +0800 Subject: [PATCH] test(compiler-core): add test for custom delimiter (#315) --- .../compiler-core/__tests__/parse.spec.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/compiler-core/__tests__/parse.spec.ts b/packages/compiler-core/__tests__/parse.spec.ts index 4237b5faf..81735aa16 100644 --- a/packages/compiler-core/__tests__/parse.spec.ts +++ b/packages/compiler-core/__tests__/parse.spec.ts @@ -410,6 +410,34 @@ describe('compiler: parse', () => { } }) }) + + test('custom delimiters', () => { + const ast = parse('

{msg}

', { + delimiters: ['{', '}'] + }) + const element = ast.children[0] as ElementNode + const interpolation = element.children[0] as InterpolationNode + + expect(interpolation).toStrictEqual({ + type: NodeTypes.INTERPOLATION, + content: { + type: NodeTypes.SIMPLE_EXPRESSION, + content: `msg`, + isStatic: false, + isConstant: false, + loc: { + start: { offset: 4, line: 1, column: 5 }, + end: { offset: 7, line: 1, column: 8 }, + source: 'msg' + } + }, + loc: { + start: { offset: 3, line: 1, column: 4 }, + end: { offset: 8, line: 1, column: 9 }, + source: '{msg}' + } + }) + }) }) describe('Comment', () => {