Skip to content

Commit 7010d75

Browse files
committed
test: add failing test for quotes in template interpolations
1 parent cd3d68c commit 7010d75

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/template.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,32 @@ describe('transform typescript template', () => {
184184
expect(output).toBe(`'test'`)
185185
})
186186

187+
it('handles quotes in interpolations', async () => {
188+
expect(
189+
await fixture(`
190+
<template>
191+
<div>
192+
<div :class="$test('foobar', \`Foobar 'test'\`)" />
193+
<div>{{ $test('foobar', "Foobar 'test'") }}</div>
194+
<div>{{ $test('foobar', 'Foobar test') }}</div>
195+
<div>{{ $test('foobar', \`Foobar ' " ''" test\`) }}</div>
196+
</div>
197+
</template>
198+
`),
199+
).toMatchInlineSnapshot(`
200+
"
201+
<template>
202+
<div>
203+
<div :class="$test('foobar', \`Foobar \\'test\\'\`)" />
204+
<div>{{ $test("foobar", "Foobar \\"test\\"") }}</div>
205+
<div>{{ $test("foobar", "Foobar test") }}</div>
206+
<div>{{ $test("foobar", \`Foobar ' " ''" test\`) }}</div>
207+
</div>
208+
</template>
209+
"
210+
`)
211+
})
212+
187213
async function fixture(src: string) {
188214
const requireFromVue = createRequire(resolveModulePath('vue'))
189215
const { parse } = requireFromVue('@vue/compiler-dom') as typeof import('@vue/compiler-dom')

0 commit comments

Comments
 (0)