fix(compiler-sfc): handle empty nodes with src attribute (#695)

This commit is contained in:
Jason
2020-02-04 23:03:32 +08:00
committed by GitHub
parent 5742a0b826
commit 2d56dfdc4f
2 changed files with 24 additions and 4 deletions

View File

@@ -73,6 +73,13 @@ h1 { color: red }
expect(parse(`<custom/>`).descriptor.customBlocks.length).toBe(0)
})
test('handle empty nodes with src attribute', () => {
const { descriptor } = parse(`<script src="com"/>`)
expect(descriptor.script).toBeTruthy()
expect(descriptor.script!.content).toBeFalsy()
expect(descriptor.script!.attrs['src']).toBe('com')
})
test('nested templates', () => {
const content = `
<template v-if="ok">ok</template>