wip: support inherit-attrs="false" on sfc <tempalte>
This commit is contained in:
@@ -33,6 +33,27 @@ return { x }
|
||||
export const n = 1"
|
||||
`;
|
||||
|
||||
exports[`SFC compile <script setup> <template inherit-attrs="false"> 1`] = `
|
||||
"
|
||||
const __default__ = {}
|
||||
__default__.inheritAttrs = false
|
||||
export default __default__"
|
||||
`;
|
||||
|
||||
exports[`SFC compile <script setup> <template inherit-attrs="false"> 2`] = `
|
||||
"export default {
|
||||
expose: [],
|
||||
inheritAttrs: false,
|
||||
setup(__props) {
|
||||
|
||||
const a = 1
|
||||
|
||||
return { a }
|
||||
}
|
||||
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`SFC compile <script setup> defineEmit() 1`] = `
|
||||
"export default {
|
||||
expose: [],
|
||||
|
||||
@@ -70,6 +70,28 @@ const myEmit = defineEmit(['foo', 'bar'])
|
||||
emits: ['foo', 'bar'],`)
|
||||
})
|
||||
|
||||
test('<template inherit-attrs="false">', () => {
|
||||
const { content } = compile(`
|
||||
<script>
|
||||
export default {}
|
||||
</script>
|
||||
<template inherit-attrs="false">
|
||||
{{ a }}
|
||||
</template>
|
||||
`)
|
||||
assertCode(content)
|
||||
|
||||
const { content: content2 } = compile(`
|
||||
<script setup>
|
||||
const a = 1
|
||||
</script>
|
||||
<template inherit-attrs="false">
|
||||
{{ a }}
|
||||
</template>
|
||||
`)
|
||||
assertCode(content2)
|
||||
})
|
||||
|
||||
describe('<script> and <script setup> co-usage', () => {
|
||||
test('script first', () => {
|
||||
const { content } = compile(`
|
||||
|
||||
Reference in New Issue
Block a user