feat(compiler-sfc): warn duplicate block (#451)
This commit is contained in:
21
packages/compiler-sfc/__tests__/parse.spec.ts
Normal file
21
packages/compiler-sfc/__tests__/parse.spec.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { parse } from '../src'
|
||||
import { mockWarn } from '@vue/runtime-test'
|
||||
|
||||
describe('compiler:sfc', () => {
|
||||
mockWarn()
|
||||
describe('error', () => {
|
||||
test('should only allow single template element', () => {
|
||||
parse(`<template><div/></template><template><div/></template>`)
|
||||
expect(
|
||||
`Single file component can contain only one template element`
|
||||
).toHaveBeenWarned()
|
||||
})
|
||||
|
||||
test('should only allow single script element', () => {
|
||||
parse(`<script>console.log(1)</script><script>console.log(1)</script>`)
|
||||
expect(
|
||||
`Single file component can contain only one script element`
|
||||
).toHaveBeenWarned()
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user