Skip to content

Commit bb9dca2

Browse files
dlxqligyyx990803
authored andcommitted
test(compiler-core): add test for custom delimiter (vuejs#315)
1 parent e3b6897 commit bb9dca2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

packages/compiler-core/__tests__/parse.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,34 @@ describe('compiler: parse', () => {
410410
}
411411
})
412412
})
413+
414+
test('custom delimiters', () => {
415+
const ast = parse('<p>{msg}</p>', {
416+
delimiters: ['{', '}']
417+
})
418+
const element = ast.children[0] as ElementNode
419+
const interpolation = element.children[0] as InterpolationNode
420+
421+
expect(interpolation).toStrictEqual({
422+
type: NodeTypes.INTERPOLATION,
423+
content: {
424+
type: NodeTypes.SIMPLE_EXPRESSION,
425+
content: `msg`,
426+
isStatic: false,
427+
isConstant: false,
428+
loc: {
429+
start: { offset: 4, line: 1, column: 5 },
430+
end: { offset: 7, line: 1, column: 8 },
431+
source: 'msg'
432+
}
433+
},
434+
loc: {
435+
start: { offset: 3, line: 1, column: 4 },
436+
end: { offset: 8, line: 1, column: 9 },
437+
source: '{msg}'
438+
}
439+
})
440+
})
413441
})
414442

415443
describe('Comment', () => {

0 commit comments

Comments
 (0)